I configure Ingress on google Kubernetes engine. I am new on ingress but as i understood ingress can serve different Loadbalancers and different LBs should be differently configured.
I have started with a simple ingress config on GKE :
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: basic-ingress
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: web-np
servicePort: 8080
- path: /v2/keys
backend:
serviceName: etcd-np
servicePort: 2379
And it works fine so I have 2 different NodePort services web-np and etcd-np
. But now I need to extend this logic with some rewrite rules so that request that points to /service1
- will be redirected to the other service1-np
service but before /service1/hello.html
must be replaced to /hello.html
. That's why I have the following questions:
kubernetes.io/ingress.global-static-ip-name
annotation that is widely used in google examples.
Ingress
- API object that manages external access to the services in a cluster, typically HTTP.Ingress may provide load balancing, SSL termination and name-based virtual hosting.
Kubernetes can have multiple Ingress
controllers. This controllers are different from each other. The Ingress
controllers mentioned by you in this particular question are:
Ingress-GCE
- a default Ingress
resource for GKE
cluster:Ingress-nginx
- an alternative Ingress
controller which can be deployed to your GKE
cluster:Ingress
configuration you pasted will use the Ingress-GCE
controller. If you want to switch to Ingress-nginx
one, you will need to deploy it and set an annotation like:
kubernetes.io/ingress.class: "nginx"
How can I configure rewrite in ingress and if it is possible with default load balancer.
There is an ongoing feature request to support rewrites with Ingress-GCE
here: Github.com: Ingress-GCE: Rewrite.
You can use Ingress-nginx
to have support for rewrites. There is an official documentation about deploying it: Kubernetes.github.io: Ingress-nginx: Deploy
For more resources about rewrites you can use:
What is default load balancer on GKE.
If you create an Ingress
resource with a default Ingress-GCE
option you will create a L7 HTTP&HTTPS LoadBalancer.
If you create a service of type LoadBalancer
in GKE
you will create an L4 Network Load Balancer
If you deploy an Ingress-nginx
controller in GKE
cluster you will create a L4 Network Loadbalancer pointing to the Ingress-nginx
controller which after that will route the traffic accordingly to your Ingress
definition. If you are willing to use Ingress-nginx
you will need to specify:
kubernetes.io/ingress.class: "nginx"
in your Ingress
definition.
Please take a look on this article: Medium.com: Google Cloud: Kubernetes Nodeport vs Loadbalancer vs Ingress
Where can I find a list of all annotations to it. I have thought that the full list is on https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/ but there is a completly different list and there is no kubernetes.io/ingress.global-static-ip-name annotation that is widely used in google examples.
The link that you provided with annotations is specifically for Ingress-nginx
. This annotations will not work with Ingress-GCE
.
The annotations used in GCP
examples are specific to Ingress-GCE
.
You can create a Feature Request for a list of available annotations for Ingress-GCE
on Issuetracker.google.com.