Skip to content

Instantly share code, notes, and snippets.

@0xAhmed
Last active October 11, 2017 11:25
Show Gist options
  • Save 0xAhmed/b03c6ffe3674c585e752fe41d0ce8a40 to your computer and use it in GitHub Desktop.
Save 0xAhmed/b03c6ffe3674c585e752fe41d0ce8a40 to your computer and use it in GitHub Desktop.
Applying a k8s Ingress for a Canary release
$ kubectl --namespace=production apply -f app-ingress-canary.yml
ingress "app-ingress" created
# If the backends report HEALTHY, we can start sending requests for testing the endpoints
$ kubectl --namespace=production describe ing
Name: app-ingress
Namespace: production
Address: 35.190.60.217
Default backend: kubeapp-production-service:80 (10.44.1.10:8080,10.44.1.8:8080,10.44.1.9:8080)
Rules:
Host Path Backends
---- ---- --------
canary.foo.bar
kubeapp-canary-service:80 (10.44.1.11:8080)
foo.bar
kubeapp-production-service:80 (10.44.1.10:8080,10.44.1.8:8080,10.44.1.9:8080)
Annotations:
forwarding-rule: k8s-fw-production-app-ingress--c01b1884e664276f
target-proxy: k8s-tp-production-app-ingress--c01b1884e664276f
url-map: k8s-um-production-app-ingress--c01b1884e664276f
backends: {"k8s-be-31930--c01b1884e664276f":"HEALTHY","k8s-be-32638--c01b1884e664276f":"HEALTHY"}
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
15m 15m 1 loadbalancer-controller Normal ADD production/app-ingress
13m 13m 1 loadbalancer-controller Normal CREATE ip: 35.190.60.217
14m 2m 5 loadbalancer-controller Normal Service default backend set to kubeapp-production-service:31930
# Set resolver to point to Ingress resource IP
$ export INGRESS_IP=$(kubectl --namespace=production get ing/app-ingress --output=json | jq -r '.status.loadBalancer.ingress[0].ip')
$ echo "$INGRESS_IP foo.bar canary.foo.bar" | sudo tee -a /etc/hosts
$ curl http://foo.bar/
Congratulations! Version 1.0 of your application is running on Kubernetes.
$ curl http://foo.bar/version
1.0
$ curl http://canary.foo.bar/
Congratulations! Version 2.0 of your application is running on Kubernetes.
$ curl http://canary.foo.bar/version
2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment