Kubernetes Mastery

Develop and Deploy Cloud Native Applications at Scale

Namespace

Key Takeaways

While a Kubernetes cluster is physically distributed across multiple machines (master and worker nodes), developers interact with it as a single entity partitioned into logical divisions called namespaces. These namespaces group together closely related resources.

Deploying to a Specific Namespace

  1. Command-line approachkubectl apply -f my-deployment.yaml -n my-namespace
  2. In YAML configuration:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  namespace: my-namespace

Default Namespace

If no namespace is specified, Kubernetes will place the resource in the default namespace.

Best Practices for Developers

  1. Use namespaces to organize and isolate your workloads logically.
  2. Be aware of the namespace you're working in to avoid unintended interactions between resources.
  3. Collaborate with your cluster administrators to understand any namespace-level policies or quotas that may affect your deployments.