Monday, October 28, 2019
Common Kubernetes Commands
The Kubernetes Client kubectl recently became an independent tool outside of the main Kubernetes repo.
Some common Kubernetes kubectl commands.
https://kubernetes.io/docs/reference/kubectl/overview/
https://github.com/kubernetes/kubectl/
https://kubernetes.io/docs/reference/kubectl/cheatsheet/
Get the current cluster / namespace context
kubectl config get-context
Use the specified cluster context
kubectl config use-context my-cluster-name
Which cluster am I on
kubectl cluster-info
Create my service/deployment/secret/configmap/replicationcontroller/pod/job
kubectl apply -f myyaml.yaml
Delete the applied object(s)
kubectl delete -f myyaml.yaml
Delete a pod
kubectl delete -n dev mydevpod
Get a list of pods for all namespaces
kubectl get pods -A
Get the logs for a pod
kubectl logs -n dev mydevpod-abcde
kubectl get internals
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/get/get.go
Copy files to a pod
kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir
Other commands
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go
get, describe, delete, label, edit, patch, annotate, expose, scale, autoscale, taint, rollout, logs, exec, rolling-update, cordon, config use-context, config delete-cluster, cp
kubectl get namespace
kubectl config get-context
kubectl config get-clusters
kubectl config get-users
Labels:
k8s,
kubectl,
kubernetes
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment