From aee027c91cc5df0d0c5cd83088606da2fd689155 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sun, 16 Jun 2019 10:32:25 +0300 Subject: [PATCH] Add Kubernetes services to FAQ --- docs/gitbook/faq.md | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/docs/gitbook/faq.md b/docs/gitbook/faq.md index b0eb69dc..e292fb7b 100644 --- a/docs/gitbook/faq.md +++ b/docs/gitbook/faq.md @@ -51,3 +51,55 @@ curl -H 'X-Canary: insider' http://app.example.com curl -b 'canary=always' http://app.example.com ``` +### Kubernetes services + +How is an application exposed inside the cluster? + +Assuming the app name is podinfo you can define a canary like: + +```yaml +apiVersion: flagger.app/v1alpha3 +kind: Canary +metadata: + name: podinfo + namespace: test +spec: + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: podinfo + service: + # container port (required) + port: 9898 + # port name can be http or grpc (default http) + portName: http +``` + +Based on the canary spec service, Flagger generates the following Kubernetes ClusterIP service: + +* `..vc.cluster.local` with selector `app=-primary` +* `-primary..vc.cluster.local` with selector `app=-primary` +* `-canary..vc.cluster.local` with selector `app=` + +This ensures that traffic coming from a namespace outside the mesh to `podinfo.test:9898` +will be routed to the latest stable release of your app. + + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: podinfo +spec: + type: ClusterIP + selector: + app: podinfo-primary + ports: + - name: http + port: 9898 + protocol: TCP + targetPort: http +``` + +The `podinfo-canary.test:9898` address is available only during the +canary analysis and can be used for conformance testing or load testing.