官网:

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

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code