Everything You Need to Know to Start Using Helm
92%
Install a Chart in a Specific Namespace
By default, Helm installs charts in the default namespace. However, if you want to change this behavior you have two options:
- Using the environment variable
HELM_NAMESPACE. This will set the default namespace for all Helm commands in the current shell session.
# Set the default namespace for Helm commands
export HELM_NAMESPACE=
# Install the chart without specifying the namespace
# and it will be installed in the namespace defined in HELM_NAMESPACE
helm install [RELEASE_NAME] [CHART]
- Using the
--namespace(or-n) flag at install time.
helm install [RELEASE_NAME] [CHART] --namespace [NAMESPACE]
# or
helm install [RELEASE_NAME] [CHART] -n [NAMESPACE]
Since version 3.2, you can force the creation of a namespace if it does not exist:
helm install [RELEASE_NAME] [CHART] --create-namespace --namespace [NAMESPACE]
For example, to install the WordPress chart in a namespace called wordpress:
# Delete any existing installation to start fresh
# This is optional and won't affect our installation
# in the new namespace
helm uninstall my-wordpress --ignore-not-found
kubectl delete pvc --all --ignore-not-found
# Install in the 'wordpress' namespace
helm install \
my-wordpress \
bitnami/wordpress \
--namespace wordpress \
--create-namespace
# Verify the installation
kubectl get all -n wordpress -l app.kubernetes.io/instance=my-wordpress
# Clean up
helm uninstall my-wordpress -n wordpress
kubectl delete pvc --all -n wordpress
This command will not delete any other WordPress installations (in the same or different namespaces). Every installation is an independent release and is unique by its name and namespace. In other words, you can have:
- Multiple releases with the same name in different namespaces.
- Multiple releases with different names in different namespaces.
- Multiple releases with different names in the same namespace.
What may cause a conflict is having multiple releases with the same name in the same namespace (Helm will prevent this).
Test Installation without Deploying
Cloud-Native Microservices With Kubernetes - 2nd Edition
A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in KubernetesEnroll now to unlock all content and receive all future updates for free.
