Home > Net >  Kubernetes Nginx ingress multiple ExternalIps
Kubernetes Nginx ingress multiple ExternalIps

Time:08-20

I install Nginx Ingress Controller on bare metal. enter image description here

now i want to add many ExternalIP , 10.24.100.55 10.24.100.56 , 10.24.100.57

This is my Deploy.yaml

spec:
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - appProtocol: http
    name: http
    port: 80
    protocol: TCP
    targetPort: http
  - appProtocol: https
    name: https
    port: 443
    protocol: TCP
    targetPort: https
  selector:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
  externalIPs:
    - 10.24.100.55
  type: NodePort

When i try to add other ips , there is error For example

externalIPs:
        - 10.24.100.55 , 10.24.100.56

is it possible ?

CodePudding user response:

You can add external IP addresses, the externalIPs option permits kube-proxy to route traffic sent to arbitrary IP addresses and on the Service ports to the endpoints of that Service.As per the official Kubernetes documentation you can add you external ip in "my-service" under spec section, you can find the details in the documentation.

One could set the following external IPs in the Service spec, and NGINX would become available on both the NodePort and the Service port after that give the following commands.

$ curl -D- http://myapp.example.com:port

HTTP/1.1 200 OK

Server: nginx/1.15.2

$ curl -D- http://myapp.example.com

HTTP/1.1 200 OK

Server: nginx/1.15.2

The myapp.example.com subdomain above resolves to both 2 IP addresses we have given.

For more information follow External IP’s.

CodePudding user response:

externalIPs:
   - 10.24.100.55 , 10.24.100.56

Try:

externalIPs:
- 10.24.100.55
- 10.24.100.56
  • Related