kubectl how to list all contexts
You can view all contexts via the config command $ kubectl config get-contexts
You can view all contexts via the config command $ kubectl config get-contexts
You need to label your deployment somehow, for example we set label app: myapp below: apiVersion: extensions/v1beta1 kind: Deployment metadata: name: nginx spec: template: metadata: labels: app: my-app spec: containers: – image: nginx name: nginx After that you can get deployment’s pod name very easy: POD=$(kubectl get pod -l app=my-app -o jsonpath=”{.items[0].metadata.name}”) and execute some … Read more
Renaming contexts is easy! $ kubectl config rename-context old-name new-name Confirm the change by $ kubectl config get-contexts
I have written up a thorough explanation of the differences between apply, replace, and patch: Kubernetes Apply vs. Replace vs. Patch. It includes an explanation that the current top-ranked answer to this question is wrong. Briefly, kubectl apply uses the provided spec to create a resource if it does not exist and update, i.e., patch, … Read more