kubernetes 1.17部署nginx ingress controller

  运维

官网:

https://github.com/kubernetes/ingress-nginx
https://github.com/kubernetes/ingress-nginx/blob/master/docs/deploy/index.md
https://github.com/kubernetes/ingress-nginx/tree/master/deploy/static

部署:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.27.0/deploy/static/mandatory.yaml

更改镜像为registry.cn-hangzhou.aliyuncs.com/sre_pub/nginx-ingress-controller:master

kubectl set image deployments nginx-ingress-controller *=registry.cn-hangzhou.aliyuncs.com/sre_pub/nginx-ingress-controller:master -n ingress-nginx

svc NodePort 改成固定端口

apiVersion: v1
kind: Service
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  type: NodePort
  ports:
    - name: http
      port: 80
      targetPort: 80
      protocol: TCP
      nodePort: 30080
    - name: https
      port: 443
      targetPort: 443
      protocol: TCP
      nodePort: 30443
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx

测试

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nacos-ingress
  namespace: nacos
  annotations: 
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: test.nacos
    http:
      paths:
      - path: 
        backend:
          serviceName: nacos-headless
          servicePort: 8848

nacs.png

LEAVE A COMMENT

发表评论前,请选对水果【Apple=苹果、Banana=香蕉、Pineapple=菠萝、Grapes=葡萄】 Pineapple...