/gke-consul-template-example

This is a sample to test consul template in GKE

Primary LanguageShell

Consul and consul-template in kubernetes to configure nginx load balancer

Testing automatic configuration of NGINX load balancer in GKE with consul-template

We deploy consul in GKE k8s cluster using Helm and deploy a 3 instance webapp We use a NGINX LB to load balance this app This load balancer is automatically configured by consul-template

Set .env file with your own variables

Note :If you create your own docker image for nginx_lb with consul-template update the nginx_lb_with_consul_template.yaml with your image name

Steps:

  1. Create your own NGINX image with consul-template or just use my image "kaparora/nginx_consul_template:latest"
  2. Deploy GKE Cluster
  3. Install Consul with Helm
  4. Install a webapp with consul inject true
  5. Deploy NGINX load balancer (including consul-template)
  6. Open the nginx-lb External IP in a browser to see the load balancer in action (Automatic initial configuration)
  7. Scale webapp and check the nginx External IP in the browser again (Automatic configuration update)
  8. Destroy GKE cluster