In the following lab we will roll out a static nginx deployment, similar to previous labs. This deployment will be exposed by a service and a HTTP/S Load Balancer. The LB will be created using the new Gateway API which is scheduled to replace the Ingress API.
- Apply all manifests
kubectl apply -f .
- Check current gateway state (external IP)
this step can take up to 3 Minutes
kubectl get gateway -n doit-lab-08 --watch
- Confirm that a Load Balancer was created on the cloud
gcloud compute forwarding-rules list --filter='description~doit-lab-08'
- You can check the state of Pods at any time with the following kubectl command:
kubectl get pods -n doit-lab-08
- You can check your ingress target service with the following kubectl command:
kubectl get service -n doit-lab-08
- You can get some more detailed information about your gateway resource by the following kubectl command:
kubectl describe gateway static-web-app-gateway -n doit-lab-08
- You can also check the HTTPRoute resource which defines all the routes that our Gateway will handle:
kubectl describe httproutes.gateway.networking.k8s.io static-web-app-httproute -n doit-lab-08
- A couple of minutes after your gateway resource and the corresponding load balancer are provisioned (3-4 minutes):
5.1 You can check the benchmark of your web-application using apache-bench command as shown below:
ab -n 20 http://<external-ip-of-your-ingress-load-balancer>/
5.2 You can simulate some traffic to your ingress facing loadBalancer by the following ab-command:
ab -n 500 -c 25 http://<external-ip-of-your-ingress-load-balancer>/
5.3 Or just visit the workload by hitting the created LB IP:
-> http://<external-ip-of-your-ingress-load-balancer>/
Now we can set the current k8s context to our lab exercise namespace doit-lab-08
to make sure that every command set is run against this lab resources.
kubectl config set-context --current --namespace=doit-lab-08
In this example we can access the authentication token with a much shorter command line (we just ignore the namespace property now).
kubectl describe gateway static-web-app-gateway
kubectl delete -f .