Cart

    Sorry, we could not find any results for your search querry.

    What is a Kubernetes namespace?

    A Kubernetes namespace can be seen as a kind of label that allows you to group and isolate components of your Kubernetes cluster, such as pods and services. This is particularly useful when running multiple use cases on a single Kubernetes cluster and you want to clearly group them to avoid confusion.

    Here are the key commands for working with namespaces:

    • Instead of 'ns', you can also use 'namespace' or 'namespaces'.
    • Instead of '-n', you can also use '--namespace'.
    • To create a namespace, use the following command:

      kubectl create ns <name>
    • To get an overview of your namespaces, use the following command:

      kubectl get ns

      You will see some default namespaces: default, kube-node-lease, kube-public, kube-system. You can safely ignore these default namespaces. Interested readers can find more information on what these namespaces are used for here.

    • To delete a namespace and all its associated resources, use the following command:

      kubectl delete ns <namespace-name>
    • You can assign Kubernetes resources, or objects/Helm Charts that you deploy to a namespace using the '-n <namespace-name>' flag. For example, when installing a Helm Chart:

      helm install -f <filename>.yaml <release-name> <repository>/<helm-chart> -n <namespace-name>

      The '-n <namespace-name>' flag (e.g., '-n traefik') assigns the Helm installation to the specified namespace. Then, you can view the deployed pods within this namespace using the command:

      kubectl get pods -n <namespace-name>

     

    Need help?

    Receive personal support from our supporters

    Contact us