Minimalistic kubernetes cluster to see source ip in google container engine
- Create a cluster in google cloud engine and leave the defaults
- Connect to the cluster (You can use either cloud console or your own terminal)
kubectl apply -f namespace.yaml
kubectl apply -f default-backend.yaml
kubectl apply -f configmap.yaml
kubectl apply -f nginx-controller.yaml
Map your External IP that you have got from below command to some domain name.
kubectl get svc --namespace=nginx-ingress nginx-ingress
kubectl apply -f source-ip-deploy.yaml
kubectl apply -f source-ip-svc.yaml
Replace host
in rules section of ingress.yaml
with your domain that you mapped earlier
kubectl apply -f ingress.yaml
For more information checkout kubernetes page