Helm - Launching a group of PVC in same AZ on AWS

2/8/2018

I'm trying to deploy the gitlab omnibus chart to my kubernetes cluster (setup across two AZs) using helm charts. The gitlab-gitlab pod uses 3 PVCs which are backed by EBS and they're generally created in different AZs. What's the idiomatic way in helm to deploy a set of PVCs in the same AWS AZ?

-- Shubham Jain
amazon-web-services
gitlab
gitlab-omnibus
kubernetes
kubernetes-helm

1 Answer

3/6/2018

Faced this issue recently. There's a workaround for making it work but not correct solution yet.

You need to create a storageclass in a particular zone. This is how it would look like:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  annotations:
  storageclass.beta.kubernetes.io/is-default-class: "false"
  labels:
    k8s-addon: storage-aws.addons.k8s.io
  name: gp2-us-east-1a
parameters:
  type: gp2
  zone: us-east-1a
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Delete

Next step is to setup gitlab deploy in same zone. There are two ways of do that. You could use nodeSelector or node affinity which .

Some examples of changes:

NodeSelector example:

nodeSelector:
  failure-domain.beta.kubernetes.io/zone: us-east-1a

Node Affinity example:

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: failure-domain.beta.kubernetes.io/zone
          operator: In
          values:
           - us-east-1a

This is a bug in dynamic provisioning. The a proposal for the same is present here and here

-- vjdhama
Source: StackOverflow