kubernetes-helmpython-2to3

how to create resources / deploy resources from helm configmaps


I have installed below helm chart with helm v2 with below command.

helm2 install stable/tensorflow-notebook -n tf2

It created below resources.


NAME                                           READY   STATUS              RESTARTS   AGE
pod/tf2-tensorflow-notebook-67c5df968b-rlhsm   0/2     ContainerCreating   0          89s

NAME                              TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                         AGE
service/tf2-tensorflow-notebook   LoadBalancer   10.0.148.137   13.83.244.95   6006:32351/TCP,8888:32147/TCP   89s

NAME                                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/tf2-tensorflow-notebook   0/1     1            0           90s

NAME                                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/tf2-tensorflow-notebook-67c5df968b   1         1         0       90s

This release created revision in kube-system namespace as configmap.

tf2.v1                               1      114s

took backup of configmap using below command.

kubectl get configmap -n kube-system -l "OWNER=TILLER" -o yaml > mychart/template/helm_release.yaml

deleted helm "tf2" release.

helm2 delete tf2
helm2 delete --purge tf2

I tried below command for recreating resources. reference ref1.

helm2 install --name tf3 ./mychart 

getting below error:

Error: no Chart.yaml exists in directory "/home/username/mychart"

Now, I want to create/restore resources/release "tf2" from configmap backup. I'm less sure about this, If we can create resouces out of this configmap.

ref1 ref2


Solution

  • The ConfigMap in the kube-system namespace is internal state used by Helm. You can't really do anything with it, and it's not something you need to back up or otherwise extract from the cluster. (The "ref2" link in the question notes that it exists but you can't decompile it in any useful way.) Similarly, there's no way to restore it, and it doesn't make sense to add it to a different Helm chart.

    If you want to make a second duplicate installation of a chart, there are two commands that can help. helm fetch stable/tensorflow-notebook will give you a local tar file that contains the upstream chart, so even if it changes in the upstream repository, you'll have a local copy of it. helm get values tf2 will write out the combined set of YAML configuration that was used to install the chart.

    In practice, this should work to duplicate an installation:

    # Get the existing values from the installed release
    helm get values tf2 > tf.yaml
    
    # Reinstall using those values
    helm install --name tf4 stable/tensorflow-notebook -n tf4 -f tf.yaml
    

    If it's important to use a fixed version of the chart:

    helm fetch stable/tensorflow-notebook
    helm install --name tf5 ./tensorflow-notebook-*.tgz -n tf5 -f tf.yaml