使用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; }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM