使用nginx替换Ingress

总感觉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; }

 

posted @ 2017-03-29 11:24  fengjian1585  阅读(2510)  评论(0编辑  收藏  举报