总感觉k8s Ingress 不可控, 所以使用nginx 替换Ingress,还是比较简单的。
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nginx-frontend
spec:
# replicas: 3
template:
metadata:
labels:
app: nginx-frontend
spec:
nodeSelector:
status: nginx-frontend
containers:
- name: nginx-frontend
image: docker.cinyi.com:443/senyint/nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-frontend
spec:
type: NodePort
ports:
- port: 80
nodePort: 32222
selector:
app: nginx-frontend
nginx配置文件为:
#dashboard的 servic IP地址。
upstream dashboard { ip_hash;
server kubernetes-dashboard.kube-system:80;
}
# imweb的 service ip地址,是服务+命名空间
upstream imweb {
ip_hash;
server im-web.test:80;
}