Skip to content

helm_Package Management in Kubernetes

Tanveer Alam edited this page Dec 8, 2019 · 3 revisions

Package Management in Kubernetes

$ helm ls
NAME	NAMESPACE	REVISION	UPDATED	STATUS	CHART	APP VERSION
$ helm search hub wordpress
URL                                               	CHART VERSION	APP VERSION	DESCRIPTION                                       
https://hub.helm.sh/charts/bitnami/wordpress      	8.0.1        	5.3.0      	Web publishing platform for building blogs and ...
https://hub.helm.sh/charts/presslabs/wordpress-...	v0.6.3       	v0.6.3     	Presslabs WordPress Operator Helm Chart           
https://hub.helm.sh/charts/presslabs/wordpress-...	v0.7.3       	v0.7.3     	A Helm chart for deploying a WordPress site on ...

https://hub.helm.sh/charts/bitnami/wordpress

$ helm repo add bitnami https://charts.bitnami.com
"bitnami" has been added to your repositories

$ helm search repo wordpress
NAME             	CHART VERSION	APP VERSION	DESCRIPTION                                       
bitnami/wordpress	8.0.1        	5.3.0      	Web publishing platform for building blogs and ...
$ helm install wordpress bitnami/wordpress
NAME: wordpress
LAST DEPLOYED: Sat Dec  7 19:24:18 2019
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the WordPress URL:

  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        Watch the status with: 'kubectl get svc --namespace default -w wordpress'
  export SERVICE_IP=$(kubectl get svc --namespace default wordpress --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
  echo "WordPress URL: http://$SERVICE_IP/"
  echo "WordPress Admin URL: http://$SERVICE_IP/admin"

2. Login with the following credentials to see your blog

  echo Username: user
  echo Password: $(kubectl get secret --namespace default wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)
$ helm ls
NAME     	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0    
$ helm install wordpress bitnami/wordpress
Error: cannot re-use a name that is still in use
helm ls
NAME     	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0      
$ helm install wordpress-1 bitnami/wordpress
NAME: wordpress-1
LAST DEPLOYED: Sat Dec  7 19:38:49 2019
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the WordPress URL:

  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        Watch the status with: 'kubectl get svc --namespace default -w wordpress-1'
  export SERVICE_IP=$(kubectl get svc --namespace default wordpress-1 --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
  echo "WordPress URL: http://$SERVICE_IP/"
  echo "WordPress Admin URL: http://$SERVICE_IP/admin"

2. Login with the following credentials to see your blog

  echo Username: user
  echo Password: $(kubectl get secret --namespace default wordpress-1 -o jsonpath="{.data.wordpress-password}" | base64 --decode)


$ helm ls
NAME       	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress  	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0      
wordpress-1	default  	1       	2019-12-07 19:38:49.327688934 +0530 IST	deployed	wordpress-8.0.1	5.3.0  
$ helm delete wordpress-1 
release "wordpress-1" uninstalled

$ helm ls
NAME     	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0      
$ helm install wordpress-1 bitnami/wordpress --version 8.0.0

$ helm list
NAME       	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress  	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0      
wordpress-1	default  	1       	2019-12-07 19:42:27.561867082 +0530 IST	deployed	wordpress-8.0.0	5.2.4      
$ helm upgrade wordpress-1 bitnami/wordpress

$ helm list
NAME       	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress  	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0      
wordpress-1	default  	2       	2019-12-07 19:43:29.073676976 +0530 IST	deployed	wordpress-8.0.1	5.3.0      

Dependency management

$ helm fetch --untar bitnami/wordpress

$ ls -1 wordpress/
charts
Chart.yaml
README.md
requirements.lock
requirements.yaml
templates
values.schema.json
values.yaml


$ tree wordpress/
wordpress/
├── charts
│   └── mariadb
│       ├── Chart.yaml
│       ├── files
│       │   └── docker-entrypoint-initdb.d
│       │       └── README.md
│       ├── OWNERS
│       ├── README.md
│       ├── templates
│       │   ├── _helpers.tpl
│       │   ├── initialization-configmap.yaml
│       │   ├── master-configmap.yaml
│       │   ├── master-pdb.yaml
│       │   ├── master-statefulset.yaml
│       │   ├── master-svc.yaml
│       │   ├── NOTES.txt
│       │   ├── rolebinding.yaml
│       │   ├── role.yaml
│       │   ├── secrets.yaml
│       │   ├── serviceaccount.yaml
│       │   ├── servicemonitor.yaml
│       │   ├── slave-configmap.yaml
│       │   ├── slave-pdb.yaml
│       │   ├── slave-statefulset.yaml
│       │   ├── slave-svc.yaml
│       │   ├── test-runner.yaml
│       │   └── tests.yaml
│       ├── values-production.yaml
│       └── values.yaml
├── Chart.yaml
├── README.md
├── requirements.lock
├── requirements.yaml
├── templates
│   ├── deployment.yaml
│   ├── externaldb-secrets.yaml
│   ├── _helpers.tpl
│   ├── ingress.yaml
│   ├── NOTES.txt
│   ├── pvc.yaml
│   ├── secrets.yaml
│   ├── servicemonitor.yaml
│   ├── svc.yaml
│   ├── tests
│   │   └── test-mariadb-connection.yaml
│   └── tls-secrets.yaml
├── values.schema.json
└── values.yaml

7 directories, 41 files
$ rm -rf ./charts/mariadb/

$ helm dep list
NAME   	VERSION	REPOSITORY                                       	STATUS 
mariadb	7.x.x  	https://kubernetes-charts.storage.googleapis.com/	missing

$ helm dep update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading mariadb from repo https://kubernetes-charts.storage.googleapis.com/
Deleting outdated charts

$ ll ./charts/
total 32
drwxr-xr-x 2 tan tan  4096 Dec  8 11:22 ./
drwxr-xr-x 4 tan tan  4096 Dec  8 11:22 ../
-rw-r--r-- 1 tan tan 22060 Dec  8 11:22 mariadb-7.3.0.tgz


$ helm dep list
NAME   	VERSION	REPOSITORY                                       	STATUS
mariadb	7.x.x  	https://kubernetes-charts.storage.googleapis.com/	ok    
$ helm list
NAME       	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress  	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0      
wordpress-1	default  	2       	2019-12-07 19:43:29.073676976 +0530 IST	deployed	wordpress-8.0.1	5.3.0   

$ helm delete wordpress-1
release "wordpress-1" uninstalled

$ helm list
NAME     	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0    


wordpress$ helm install wordpress-1 .
NAME: wordpress-1
LAST DEPLOYED: Sun Dec  8 11:27:32 2019
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the WordPress URL:

  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        Watch the status with: 'kubectl get svc --namespace default -w wordpress-1'
  export SERVICE_IP=$(kubectl get svc --namespace default wordpress-1 --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
  echo "WordPress URL: http://$SERVICE_IP/"
  echo "WordPress Admin URL: http://$SERVICE_IP/admin"

2. Login with the following credentials to see your blog

  echo Username: user
  echo Password: $(kubectl get secret --namespace default wordpress-1 -o jsonpath="{.data.wordpress-password}" | base64 --decode)

$ helm list
NAME       	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART          	APP VERSION
wordpress  	default  	1       	2019-12-07 19:24:18.902421987 +0530 IST	deployed	wordpress-8.0.1	5.3.0      
wordpress-1	default  	1       	2019-12-08 11:27:32.51396584 +0530 IST 	deployed	wordpress-8.0.1	5.3.0

Cleanup:

$ helm delete wordpress wordpress-1
release "wordpress" uninstalled
release "wordpress-1" uninstalled

$ helm list
NAME	NAMESPACE	REVISION	UPDATED	STATUS	CHART	APP VERSION

$ kubectl get pod
No resources found.

HELM


YAML Essentials


Helm Deep Dive

Clone this wiki locally