Skip to content

Deployer un Chart HELM

Installer le chart

Le chart généré par défaut exécute un serveur NGINX exposé via un service de type ClusterIP.

Pour l’exposer avec un service NodePort, exécuter la commande suivante :

Terminal window
helm install mynginx ./myhelm --set service.type=NodePort
Terminal window
NAME: mynginx
NAMESPACE: development
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace development -o jsonpath="{.spec.ports[0].nodePort}" services mynginx-myhelm)
export NODE_IP=$(kubectl get nodes --namespace development -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT

Lister les Charts installés

Terminal window
helm list
Terminal window
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mynginx development 1 2021-03-09 09:53:10.185241039 +0200 CEST deployed myhelm-0.1.0 1.16.0

Lister les objets kubernetes créés

Terminal window
kubectl get deploy,svc
Terminal window
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/mynginx-myhelm 1/1 1 1 8m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/mynginx-myhelm NodePort 10.107.172.175 <none> 80:32298/TCP 8m

Modifier le chart

Pour cela, il faut modifier certaines valeurs du ficher values.yaml

Terminal window
vi myhelm/values.yaml
Terminal window
replicaCount: 2
image:
repository: httpd
pullPolicy: IfNotPresent
tag: "2.4-alpine"
service:
type: NodePort
port: 80
Terminal window
helm install myweb ./myhelm
Terminal window
NAME: myweb
NAMESPACE: development
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace development -o jsonpath="{.spec.ports[0].nodePort}" services myweb-myhelm)
export NODE_IP=$(kubectl get nodes --namespace development -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT