Configure Static IP Nginx ingress Kubernetes – Linux Guru

Spread the love



You have a web server running on kubernetes and expose it on a domain name and you need the external ip of an application to be a static ip that does not change.
  • Reserve a new static IP address for INGRESS.
  • Reserve a static external IP address named my-website-ip by run following command from your machine.
$ gcloud compute addresses create my-website-ip --global
here now we have reserved the static ip for the ingress, lets create ingress controller for the application and attached the static ip.
  • lets create ingress file and describe the service name and static IP.
$ ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: yourappname-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: "my-website-ip"
spec:
  backend:
    serviceName: mywebsite-service
    servicePort: 80
Apply the ingress file and check your app, It should be access by static IP and you should point that IP to your domain name.
Linuxguru
See also  Deploy Nginx on Kubernetes GCP - Linux Guru

Leave a Comment