Add Kubernetes services to FAQ

This commit is contained in:
stefanprodan 2019-06-16 10:32:25 +03:00
parent c106796751
commit aee027c91c
1 changed files with 52 additions and 0 deletions

View File

@ -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:
* `<name>.<namespaces>.vc.cluster.local` with selector `app=<name>-primary`
* `<name>-primary.<namespaces>.vc.cluster.local` with selector `app=<name>-primary`
* `<name>-canary.<namespaces>.vc.cluster.local` with selector `app=<name>`
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.