From a9c7466359fcc882c8edf71365ea21b6902bd43a Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sun, 16 Jun 2019 11:18:51 +0300 Subject: [PATCH] Add pod affinity and label selectors to FAQ --- docs/gitbook/faq.md | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/docs/gitbook/faq.md b/docs/gitbook/faq.md index e33905f0..1ae57233 100644 --- a/docs/gitbook/faq.md +++ b/docs/gitbook/faq.md @@ -155,6 +155,63 @@ spec: Both port `8080` and `9090` will be added to the ClusterIP services but the virtual service will point to the port specified in `spec.service.port`. +### Label selectors + +What labels selectors are supported by Flagger? + +The target deployment must have a single label selector in the format `app: `: + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podinfo +spec: + selector: + matchLabels: + app: podinfo + template: + metadata: + labels: + app: podinfo +``` + +Besides `app` Flagger supports `name` and `app.kubernetes.io/name` selectors. If you use a different +convention you can specify your label with the `-selector-labels` flag. + +Is pod affinity and anti affinity supported? + +For pod affinity to work you need to use a different label than the `app`, `name` or `app.kubernetes.io/name`. + +Anti affinity example: + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podinfo +spec: + selector: + matchLabels: + app: podinfo + affinity: podinfo + template: + metadata: + labels: + app: podinfo + affinity: podinfo + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + affinity: podinfo + topologyKey: kubernetes.io/hostname +``` + ### Istio Mutual TLS How can I enable mTLS for a canary?