Configure Static IP Nginx ingress Kubernetes - Linux Guru



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.

Linux Guru

Welcome to my Linux blog! Hello Friends, I am Vishal Vyas. I am a DevOps engineer and expert in Linux and Cloud Computing. Also I am a Certified Kubernetes Administrator, I have a total 12 plus years of experience in the IT field and I have worked in various technologies. I write about Linux, AWS, DevOps and web Technologies, I have started this blog to share my technical knowledge with all, I am posting here what I learn from the latest web technologies and the likes.

Post a Comment

Previous Post Next Post