Kubernetes
Kubernetes Commands
Change current namespace
k config set-context --current --namespace=ps-dev
Check the current namspace
k get sa default -o=jsonpath='{.metadata.namespace}'
Monitor the status of the pods
k get pods --watch
Get the services
k get svc
Check the logs of init container
k logs ckad-app -c svc-check
Get storage classes
k get sc
Get pods from kube-system namespace
k get pods -n kube-system
Create deployment using kubectl
k create deployment nginx --image=nginx:alpine --dry-run=client -o yaml > deploy.yaml
Imperatively scale the deployment pods to 4
k scale deployment nginx --replicas=4
Declaratively scale the deployment pods to 4
nano deploy.yaml
k apply -f deploy.yaml
Change Service’s selector to green (imperative)
k set selector svc [service-name] 'role=green'