Differences between revisions 1 and 37 (spanning 36 versions)
Revision 1 as of 2019-03-13 19:52:28
Size: 237
Editor: PieterSmit
Comment:
Revision 37 as of 2022-08-02 02:27:36
Size: 4391
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from Kubernetes/helm
## page was renamed from kubernetes/helm
Line 2: Line 4:
 Links:  Links: [[k8s/Azure]] , [[k8s/Monitoring]] , [[k8s/helm/HelmV2ToV3]] , https://lzone.de/blog/Helm-Best-Practices , [[https://github.com/zendesk/helm-secrets| encrypt secrets]], [[k8s/helm/secrets]]
        [[k8s/helm/examples]]
== Helm - create own chart ==
 1. kubectl create namespace <NS>
 1. helm -n <NS> create <Name> <chart-name>
 1. helm -n <Ns> list
 1. helm -n <NS> uninstall <Name>

== Helm 2022 ==
 * find charts @ https://artifacthub.io/packages/helm/
 * e.g. jenkins {{{
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add https://artifacthub.io/packages/helm/jenkinsci/jenkins
helm repo update
helm search repo jenkins

kubectl create namespace jenkins
# namespace/jenkins created
helm install jenkins jenkins/jenkins -n jenkins

NOTES:
1. Get your 'admin' user password by running:
  kubectl exec --namespace jenkins -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo
2. Get the Jenkins URL to visit by running these commands in the same shell:
  echo http://127.0.0.1:8080
  kubectl --namespace jenkins port-forward svc/jenkins 8080:8080
}}}

== Helm3 2020-04 ==
 1. On local chart (main deployment of all components)
    1. helm repo index .
       * This index's charts under ./charts and create a new ./index.yam
    1. helm repo add stable https://kubernetes-charts.storage.googleapis.com/
    1. helm repo add
    1. helm search repo rabbitmq

== Helm setup 2020-01 ==
 1. Create a dir and add Chart.yaml with version and maintainer.
 2. Create requirements.yaml file with external charts needed
    * search for versions with {{{$ helm search -l stable/rabbitmq-ha }}}
 3. Install local charts from google with {{{$ helm dependency update }}}
 4. Verify with {{{$ helm dependency list }}}


== Install 2019-03 ==
 * Ran official curl, and get_helm, all fine
 * When deploying chart got an error, tiller not allowed to create namespaces.
 * Fixed with command belown and helm init --upgrade {{{{{
kubectl create serviceaccount --namespace kube-system tiller
 # serviceaccount "tiller" created

kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
 # clusterrolebinding "tiller-cluster-rule" created

kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
 # deployment "tiller-deploy" patched

}}}}}

== 201903 add ingress and static ip ==
 
 1. Get k8s nodeResourceGroup grom gui or with {{{
az aks show --resource-group <rgK8S> --name <clusterName> --query nodeResourceGroup -o tsv
}}}
 1. provision static ip with {{{
az network public-ip create --resource-group <MC_K8S_from_above> --name <cluster-PublicIP> --allocation-method static
}}}
 1. assign ip to nginx ingress controller {{{
helm install stable/nginx-ingress -namespace kube-system --set controller.service.loadBalancerIP="52.23.23.32" --set controller.replicaCount=2
}}}

== Run 2019-02 ==
Line 4: Line 77:
Line 5: Line 79:
Line 6: Line 81:

 * helm status p1
 * helm history p1
 * helm rollback p1 3; roll back to version 3

 * helm rollback; to last successfully DEPLOYED revision

 * helm upgrade --debug --dry-run
 * helm upgrade --install


=== Tricks ===
 * Use checksum of config map to change app annotation and force a new version to be deployed for apps that do not pick up new configs.
   * https://helm.sh/docs/developing_charts/#hooks
   * https://youtu.be/WugC_mbbiWU?t=1043
 * hooks {{{
annotation:
  "helm.sh/hook": " "
}}}
=== HELM install/uninstall ===
 * Please look for official current documentation {{{
helmins() {
 kubectl -n kube-system create serviceaccount tiller
 kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
 helm init --service-account=tiller
}
helmdel() {
 kubectl -n kube-system delete deployment tiller-deploy
 kubectl delete clusterrolebinding tiller
 kubectl -n kube-system delete serviceaccount tiller
 
}
}}}
----
CategoryK8sKubernetes

Kubernetes helm chart notes

Helm - create own chart

  1. kubectl create namespace <NS>

  2. helm -n <NS> create <Name> <chart-name>

  3. helm -n <Ns> list

  4. helm -n <NS> uninstall <Name>

Helm 2022

  • find charts @ https://artifacthub.io/packages/helm/

  • e.g. jenkins

    helm repo add bitnami https://charts.bitnami.com/bitnami
    helm repo add https://artifacthub.io/packages/helm/jenkinsci/jenkins
    helm repo update
    helm search repo jenkins
    
    kubectl create namespace jenkins
    # namespace/jenkins created
    helm install jenkins jenkins/jenkins -n jenkins
    
    NOTES:
    1. Get your 'admin' user password by running:
      kubectl exec --namespace jenkins -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo
    2. Get the Jenkins URL to visit by running these commands in the same shell:
      echo http://127.0.0.1:8080
      kubectl --namespace jenkins port-forward svc/jenkins 8080:8080

Helm3 2020-04

  1. On local chart (main deployment of all components)
    1. helm repo index .
      • This index's charts under ./charts and create a new ./index.yam
    2. helm repo add stable https://kubernetes-charts.storage.googleapis.com/

    3. helm repo add
    4. helm search repo rabbitmq

Helm setup 2020-01

  1. Create a dir and add Chart.yaml with version and maintainer.
  2. Create requirements.yaml file with external charts needed
    • search for versions with $ helm search -l stable/rabbitmq-ha 

  3. Install local charts from google with $  helm dependency update 

  4. Verify with $  helm dependency list 

Install 2019-03

  • Ran official curl, and get_helm, all fine
  • When deploying chart got an error, tiller not allowed to create namespaces.
  • Fixed with command belown and helm init --upgrade

    kubectl create serviceaccount --namespace kube-system tiller
     # serviceaccount "tiller" created
    
    kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
     # clusterrolebinding "tiller-cluster-rule" created
    
    kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' 
     # deployment "tiller-deploy" patched

201903 add ingress and static ip

  1. Get k8s nodeResourceGroup grom gui or with

    az aks show --resource-group <rgK8S> --name <clusterName> --query nodeResourceGroup -o tsv
  2. provision static ip with

    az network public-ip create --resource-group <MC_K8S_from_above> --name <cluster-PublicIP> --allocation-method static
  3. assign ip to nginx ingress controller

    helm install stable/nginx-ingress  -namespace kube-system  --set controller.service.loadBalancerIP="52.23.23.32"  --set controller.replicaCount=2

Run 2019-02

  • helm install --name p1 git/helmchart/ --namespace piet --set "env=DEV" --timeout 600
  • Run: helm ls --all p1; to check the status of the release
  • run: helm del --purge p1; to delete it
  • helm status p1
  • helm history p1
  • helm rollback p1 3; roll back to version 3
  • helm rollback; to last successfully DEPLOYED revision
  • helm upgrade --debug --dry-run
  • helm upgrade --install

Tricks

HELM install/uninstall

  • Please look for official current documentation

    helmins() {
     kubectl -n kube-system create serviceaccount tiller
     kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
     helm init --service-account=tiller
    }
    helmdel() {
     kubectl -n kube-system delete deployment tiller-deploy
     kubectl delete clusterrolebinding tiller
     kubectl -n kube-system delete serviceaccount tiller
     
    }


CategoryK8sKubernetes

k8s/helm (last edited 2022-08-02 02:27:36 by PieterSmit)