I am trying to create a Helm chart (x) with 5 deployments within chart (x) in a specific order:
Helm/Tiller version: "v2.12.3" Kubectl version: Major:"1", Minor:"17" Minikube version: v1.6.2
What I currently have: RESOURCES: ==> v1/Deployment
NAME
I can easily deploy chart (x) but once I run helm ls, my (x) chart is in a random order as you can see above. I only have one chart name (x) and within (x) I have:
Chart.yaml charts templates values.yaml
Templates and charts are directories and the rest are files. Is there a specific way or trick to have my x (chart) in the order I want? I’ve done some research and I am not so sure if helm spray in the right call as I am trying to deploy 1 chart with different deployment as opposed to an umbrella chart, and many other sub-charts. Let me know if you need more info.
Helm is package manager, allows you to define applications as a set of components on your cluster, and provides mechanisms to manage those sets from start to end.
Helm itself its not creating pods, it send requests to Kubernetes api and then Kubernetes is creating everything.
I have one idea how it can be achieve using Helm.
Helm order of deploying Kinds
is hardcoded here. However if you want to set deploying order of the same kind to k8s, it can be done using annotations
.
You could set annotations: Pre-install hook with hook-weight
like in this example (lower value in hook-weight have higher priority). Similar case can be found on Github.
It would look like example below:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
helm.sh/hook: pre-install
helm.sh/hook-weight: "10"
labels:
app.kubernetes.io/instance: test
...
You can check which deployment was created first using kubectl get events
. However, creation of pods is still scheduled by Kubernetes.
To obtain exactly what you need you can use initContainers and hardcode
"sleep" command.
First deployment with sleep 1s, second deployment with 5s, third with 10s, depends how long deployment need to create all pods.
You can check this article, but keep in mind spec.containers
and spec.initContainers
are two different things.