Kubernetes provides namespaces as a way to create isolated environments within a cluster (e.g. dev,test,prod)
https://github.com/lastcoolnameleft/demos/blob/master/k8s-lab/k8s-create-namespaces.yaml
apiVersion: v1
kind: Namespace
metadata:
name: test
labels:
name: test
---
apiVersion: v1
kind: Namespace
metadata:
name: prod
labels:
name: prod
Create a test and prod namespace deployment using the kubectl create command:
kubectl create -f https://raw.githubusercontent.com/lastcoolnameleft/demos/master/k8s-lab/k8s-create-namespaces.yaml
Use the UI or command line to verify the available namespaces now include test and prod:
kubectl get namespaces
Deploy the demo application into the test namespace
kubectl config get-contexts
kubectl config set-context test --cluster=$RESOURCE_GROUP --user=$USER --namespace=test
kubectl config use-context test
kubectl config get-contexts