{"id":20153718,"url":"https://github.com/vladwa/kuberenetes-kubectl-cheatsheet","last_synced_at":"2026-03-02T13:40:12.898Z","repository":{"id":181749948,"uuid":"254652628","full_name":"vladwa/kuberenetes-kubectl-cheatsheet","owner":"vladwa","description":"Kubernetes or Kubectl cheatsheet. ","archived":false,"fork":false,"pushed_at":"2020-09-25T16:02:10.000Z","size":245,"stargazers_count":50,"open_issues_count":0,"forks_count":36,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-20T20:03:27.429Z","etag":null,"topics":["cheatsheets","cka","cka-commands","ckad-commands","docker","k8s","kubectl","kubectl-cheatsheet","kubectl-command","kubernetes","kubernetes-che","kubernetes-cluster"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vladwa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-04-10T14:18:51.000Z","updated_at":"2025-03-14T17:04:07.000Z","dependencies_parsed_at":"2023-07-21T17:16:19.633Z","dependency_job_id":null,"html_url":"https://github.com/vladwa/kuberenetes-kubectl-cheatsheet","commit_stats":null,"previous_names":["vladwa/kuberenetes-kubectl-cheatsheet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vladwa/kuberenetes-kubectl-cheatsheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladwa%2Fkuberenetes-kubectl-cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladwa%2Fkuberenetes-kubectl-cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladwa%2Fkuberenetes-kubectl-cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladwa%2Fkuberenetes-kubectl-cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vladwa","download_url":"https://codeload.github.com/vladwa/kuberenetes-kubectl-cheatsheet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladwa%2Fkuberenetes-kubectl-cheatsheet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30005033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T12:19:43.414Z","status":"ssl_error","status_checked_at":"2026-03-02T12:19:02.215Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cheatsheets","cka","cka-commands","ckad-commands","docker","k8s","kubectl","kubectl-cheatsheet","kubectl-command","kubernetes","kubernetes-che","kubernetes-cluster"],"created_at":"2024-11-13T23:20:56.983Z","updated_at":"2026-03-02T13:40:12.857Z","avatar_url":"https://github.com/vladwa.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Kubernetes kubectl cheatsheet\n\n\u003cdiv id=\"the whole thing\" style=\"overflow: hidden;\"\u003e\n\u003cdiv style=\"float: left; padding: 5px\"\u003e \u003ca href=\"https://www.linkedin.com/in/vinayakavladwa\"\u003e\u003cimg src=\"https://github.com/vladwa/cka-ckad-prep-notes/blob/master/linkedin.png\" alt=\"linkedin\" /\u003e\u003c/a\u003e\u003c/div\u003e\n\n### [Kubernetes Components](https://kubernetes.io/docs/concepts/overview/components/)\n#### Control Plane Components (Master Nodes)\n| Component Name                    | Summary | Runs As | \n|-------------------------|--------------------------------------------------------------------------------------------------------| ----------- | \n| kube-apiserver          | `Exposes the Kubernetes API from master nodes.The API server is the front end for the Kubernetes control plane. Can run several instances of kube-apiserver and balance traffic between those instances` | `Static Pod` |\n| etcd                  | `Consistent and highly-available key value store used as Kubernetes’ backing store for all cluster data` | `Static Pod` or `Systemd service` |\n| kube-scheduler          | `Component that watches for newly created Pods with no assigned node, and selects a node for them to run on` | `Static Pod` |\n| kube-controller-manager| `Component that runs controller processesnode. Controllers include : Node Controller, Replication Controller, Endpoints Controller, Service Account \u0026 Token Controllers`| `Static Pod` |\n\n#### Node Components(Worker Nodes)\n| Component Name              | Summary | Runs As |\n|-------------------|-------------------------------------------------------------------------------------------| ---- |\n| kubelet           | `An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod` | `System process` |\n| kube-proxy        | `kube-proxy is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept` | `Daemonset` |\n| Container Runtime | `Is the software that is responsible for running containers. Kubernetes supported runtimes: Docker, rkt, runc and any [[https://github.com/opencontainers/runtime-spec][OCI runtime-spec]] implementation` | `Systemd service` |\n\nMaster and Worker nodes ports \n![alt text](ports.png)\n\n### [Generators](https://kubernetes.io/docs/reference/kubectl/conventions/#generators)\n**You can create the following resources using kubectl run with the --generator flag**\n\n| **Resource**  | **api group** | **kubectl command** |\n| -------------                          | ------------- | ------- |\n| Pod                                    | v1       | `kubectl run --generator=run-pod/v1` |\n| Replication controller (deprecated)    | v1 | `kubectl run --generator=run/v1` |\n| Deployment (deprecated) | apps/v1beta1 | `kubectl run --generator=deployment/apps.v1beta1` |\n| Job (deprecated)                       | batch/v1 | `kubectl run --generator=job/v1` |\n| CronJob (deprecated)                   | batch/v1beta1 | `kubectl run --generator=cronjob/v1beta1` |\n| CronJob (deprecated)                   | batch/v2alpha1 | `kubectl run --generator=cronjob/v2alpha1` |\n\n### Configuration and Logs details of Kubernetes,Docker\n\n| Description               | Folder or File location                                                                   |\n|-------------------------- | ---------------------------------------------------------------------------|\n| Config folder             | `/etc/kubernetes/`                                                        |\n| Manifests dir             | `/etc/kubernetes/manifests`                                               |\n| Certificate files         | `/etc/kubernetes/pki/`                                                   |\n| Credentials to API server | `/etc/kubernetes/kubelet.conf`                                            |\n| Superuser credentials     | `/etc/kubernetes/admin.conf`                                             |\n| kubectl config file       | `~/.kube/config`                                                         |\n| Kubernets working dir     | `/var/lib/kubelet/`                                                      |\n| Docker working dir        | `/var/lib/docker/`, `/var/log/containers/`                                |\n| Etcd working dir          | `/var/lib/etcd/`                                                          |\n| Network cni               | `/etc/cni/net.d/`                                                         |\n| Log files                 | `/var/log/pods/`                                                          |\n| Kubelet logs              | `/var/log/messages`, `/var/log/pods/kube-system_kube-proxy*/kube-proxy/*.log`|\n| Kube-proxy                | `/var/log/pods/kube-system_kube-proxy*/kube-proxy/*.log`                  | \n| Kube-api-server           | `/var/log/pods/kube-system_kube-apiserver*/kube-proxy/*.log`              |\n| Kube-controller           | `/var/log/pods/kube-system_kube-controller*/kube-proxy/*.log`             |\n| Kube-scheduller           | `/var/log/pods/kube-system_kube-scheduler*/kube-scheduler/*.log`          |\n| Env                       | `/etc/systemd/system/kubelet.service.d/10-kubeadm.conf`                   |\n| Env                       | `export KUBECONFIG=/etc/kubernetes/admin.conf`                            |\n| Audit logs                | `/var/log/audit/audit.log` | \n| Kubelet env file          | `/etc/kubernetes/kubelet.env` |\n| kubelet.service           | `/etc/systemd/system/kubelet.service` |\n| docker.service            | `/etc/systemd/system/docker.service` |\n\n### Check health of cluster\n| Description | command |\n| ----------- | ------- |\n| Check cluster health | `kubectl get componentstatus` |\n| Check etcd health | `kubectl get --raw=/healthz/etcd` |\n\n### Kubelet and Docker commands \n| Description | Command or File location|\n| ------------ | -------------- |\n| Check Kubelet status | `service kubelet status` or `systemctl status kubelet.service` |\n| Restart Kubelet | `service kubelet restart` or `systemctl restart kubelet.service` |\n| Stop Kubelet | `service kubelet stop` or `systemctl stop kubelet.service` |\n| Tail Kubelet logs | `journalctl -u kubelet.service -f` |\n| Check Docker daemon status | `service docker status` or `systemctl status docker.service`|\n| Restart Docker daemon | `service docker restart` or `systemctl restart docker.service` |\n| Stop Docker daemon | `service docker stop` or `systemctl stop docker.service` |\n| Tail Docker daemon logs | `journalctl -u docker.service -f` |\n\n### Kubernetes networking commands\n| Description | Command |\n| ----------- | ------- |\n| List interfaces on the host | `ip link` |\n| Lists IP address assigned to the interfaces | `ip addr` |\n| View the routing table | `ip route` |\n| Add the entries to the routing table| `ip route add 192.168.1.0/24 via 192.168.2.1` |\n| Enable ipv4 forwarding | `echo 1 \u003e /proc/sys/net/ipv4/ip_forward`|\n| Enable ipv6 forwarding | `echo 1 \u003e /proc/sys/net/ipv6/ip_forward`| \n| list network namespaces | `ip netns` |\n| Adding blue namespace | `ip netns add blue` |\n| Exec to the particular namesapce | `ip netns exec NAMESPACE_NAME ip link` or `ip -n red link` |\n\n\n\n### [Kubernetes cluster upgrade kubeadm way](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)\n| Description | Command |\n| ----------- | ------- |\n| Install kubeadm new version | `apt-get upgrade -y kubeadm=1.19.0-00` |\n| Upgrade plan | `kubeadm upgarade plan v1.19.0` |\n| Apply upgrade plan| `kubeadm upgrade apply v1.19.0` |\n| Update kubelet | `apt-get upgrade kubelet=1.19.0-00` |\n| Update kubelet configuration | `kubeadm upgarde node config --kubelet-version v1.19.0` |\n| Restart kubelet | `systemctl restart kubelet` |\n\n\n### [ETCD Backup \u0026 Restore](https://github.com/mmumshad/kubernetes-the-hard-way/blob/master/practice-questions-answers/cluster-maintenance/backup-etcd/etcd-backup-and-restore.md)\n| Description | Command |\n| ----------- | ------- |\n| ETCD Backup | `ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=\"/etc/kubernetes/pki/etcd/server.crt\" --cert=\"/etc/kubernetes/pki/etcd/ca.crt\" --key=\"/etc/kubernetes/pki/etcd/ca.key\" snapshot save /tmp/snapshot-pre-boot.db` |\n| ETCD Restore | `ETCDCTL_API=3 etcdctl --endpoints=https://[127.0.0.1]:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --name=master --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key --data-dir /var/lib/etcd-from-backup --initial-cluster=master=https://127.0.0.1:2380 --initial-cluster-token etcd-cluster-1 --initial-advertise-peer-urls=https://127.0.0.1:2380 snapshot restore /tmp/snapshot-pre-boot.db` |\n\n### [Pod](https://kubernetes.io/docs/concepts/workloads/pods/pod/#what-is-a-pod) \n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `pods`  | `po`  | -  | `true` | `Pod` | `[create delete deletecollection get list patch update watch]` |\n\n| Description | Kubectl Command |\n| ------------- | ------------- |\n| Create | `kubectl run nginx --generator=run-pod/v1 --image=nginx`|\n| Create in particular namespace | `kubectl run nginx --generator=run-pod/v1 --image=nginx -n NAMEPSPACE` |\n| Dry run,print object without creating it | `kubectl run POD_NAME --generator=run-pod/v1 --image=nginx --dry-run -o yaml` |\n| Create from File | `kubectl create -f pod.yaml` |\n| Create from File in particular namespace |  `kubectl create -f pod.yaml -n NAMEPSPACE` |\n| List pods | `kubectl get po` or `kubectl get pod` or `kubectl get pods` |\n| List pods in all namespaces | `kubectl get pods --all-namespaces` or `kubectl get pods -A` |\n| List pods with more information | `kubectl get pods -owide` |\n| List pods information in custom columns | `kubectl get pod POD_NAME -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image` |\n| Verbose Debug information/describe pod | `kubectl describe pod POD_NAME` |\n| Logs | `kubectl logs POD_NAME` |\n| Logs (multi-container case) | `kubectl logs POD_NAME -c CONTAINER_NAME` |\n| Tail pod logs | `kubectl logs -f POD_NAME` | \n| Tail pods logs (multi-container case) | `kubectl logs -f POD_NAME -c CONTAINER_NAME` | \n| Delete pod | `kubectl delete pod POD_NAME` or `kubectl delete -f pod.yaml` or `kubectl delete pod/POD_NAME` |\n| Delete pod in particular namespace | `kubectl delete pod POD_NAME -n NAMESPACE` |\n| Delete pod forcefully | `kubectl delete pod my-pod --grace-period=0 --force` |\n| Get pod | `kubectl get pod POD_NAME` |\n| Watch pod | `kubectl get pod POD_NAME --watch` |\n| Patch pod | `kubectl patch pod valid-pod -p '{\"spec\":{\"containers\":[{\"name\":\"kubernetes-serve-hostname\"}]}}'` |\n| Create and wrtie its spec to file | `kubectl run POD_NAME --image=nginx --restart=Never --dry-run -o yaml \u003e pod.yaml`\n| List pod in Json output format | `kubectl get pods -o json` |\n| List pod in YAML output format | `kubectl get pods -o yaml` |\n| Run command in existing pod | `kubectl exec POD_NAME -- ls /` |\n| Run command in existing pod (multi-container case) | `kubectl exec POD_NAME -c CONTAINER_NAME -- ls /` |\n| Exec to pod | `kubectl exec -it POD_NAME bash` |\n| List Kubernetes critical pods | `kubectl get pods -n kube-system` |\n\n\n### [ReplicaSet](https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/) \n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `replicasets`  | `rs`  | `apps`,`extensions` | `true` | `ReplicaSet` | `[create delete deletecollection get list patch update watch]` |\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| create | `kubectl create -f replicaset.yaml`|\n| List | `kubectl get rs` or `kubectl get replicaset` or `kubectl get replicasets` |\n| List replicasets with more information | `kubectl get rs -owide`|\n| List in all namespaces | `kubectl get rs --all-namespaces` or `kubectl get rs -A` |\n| Delete | `kubectl delete rs REPLICASET_NAME` or `kubectl delete -f replicaset.yaml`|\n| Get | `kubectl get rs REPLICASET_NAME` |\n\n### [Deployments,Scale,Rolling Updates \u0026 Rollbacks](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)\n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `deployments`  | `deploy`  | `apps`,`extensions` | `true` | `Deployment` | `[create delete deletecollection get list patch update watch]` |\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| Deployment Strategy Types | `Rolling-Update` or `Recreate` |\n| Create Deployment | `kubectl create deployment DEPLOYMENT_NAME --image=busybox` |\n| Run deployment with 2 replicas | `kubectl run POD_NAME --image=nginx --replicas=2 --port=80`|\n| List deployments | `kubectl get deploy` or `kubectl get deployment` or `kubectl get deployments` |\n| List deployments in all namespaces | `kubectl get deploy --all-namespaces` or `kubectl get deploy -A` |\n| List deployments in particular namespace | `kubectl get deploy -n NAMESPACE` |\n| List deployments with more information | `kubectl get deploy -owide`|\n| Delete deployment | `kubectl delete deploy DEPLOYMENT_NAME` or `kubectl delete -f deployment.yaml`|\n| Get particular deployment | `kubectl get deploy DEPLOYMENT_NAME` |\n| Run deployment and expose it | `kubectl run DEPLOYMENT_NAME --image=nginx --port=80 --expose` |\n| Update the nginx Pods to use the nginx:1.9.1 image instead of the nginx:1.7.9 image | `kubectl set image deployment/nginx-deployment nginx=nginx:1.9.1 --record` |\n| Edit the Deployment | `kubectl edit deploy/DEPLOYMENT_NAME` |\n| Deployment rollout status | `kubectl rollout status deploy/DEPLOYMENT_NAME` |\n| Deployment rollout history | `kubectl rollout history deploy/DEPLOYMENT_NAME` |\n| Rolling back deployment to previous version| `kubectl rollout undo deploy/DEPLOYMENT_NAME` |\n| Scaling deployment  | `kubectl scale --replicas=2 deploy/DEPLOYMENT_NAME` |\n| Pausing deployment | `kubectl rollout pause deploy/DEPLOYMENT_NAME` |\n| Resuming deployment | `kubectl rollout resume deploy/DEPLOYMENT_NAME` |\n| Verbose Debug information/describe deployment | `kubectl describe deploy/DEPLOYMENT_NAME` |\n| Describe all deployments | `kubectl describe deployments` |\n| Watch deployment | `kubectl get deploy/DEPLOYMENT_NAME --watch` |\n\n### [DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/)\n\n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `daemonsets`  | `ds`  | `apps`,`extensions` | `true` | `DaemonSet` | `[create delete deletecollection get list patch update watch]` |\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| List daemonsets | `kubectl get ds` or `kubectl get daemonset` or `kubectl get daemonset` |\n| List daemonsets in all namespaces | `kubectl get ds --all-namespaces` or `kubectl get ds -A` |\n| List daemonsets with more information | `kubectl get ds -owide`|\n| Delete | `kubectl delete ds DAEMONSET_NAME` or `kubectl delete -f daemonset.yaml`|\n| Get particular daemonset | `kubectl get ds DAEMONSET_NAME` |\n| Verbose Debug information/describe Daemonset | `kubectl describe ds/DAEMONSET_NAME` |\n\n### [Jobs](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/)\n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `jobs`  |  -   | `batch` | `true` | `Job` | `[create delete deletecollection get list patch update watch]` |\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| Create | `kubectl create job my-job --image=busybox`|\n| Create a job with command | `kubectl create job my-job --image=busybox -- date` |\n| Create a job from a CronJob named \"a-cronjob\" | `kubectl create job test-job --from=cronjob/a-cronjob`|\n| List jobs | `kubectl get jobs` or `kubectl get job` |\n| List jobs in all namespaces | `kubectl get jobs --all-namespaces` or `kubectl get jobs -A` |\n| List with more information | `kubectl get job -owide`|\n| Delete | `kubectl delete jobs JOB_NAME` or `kubectl delete -f job.yaml`|\n| Get particular cronjob | `kubectl get cj cronjob_NAME` |\n| Verbose Debug information/describe job | `kubectl describe jobs/CRRONJOB_NAME` |\n\n\n### [CronJob](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/)\n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `cronjobs`  | `cj`  | `batch` | `true` | `CronJob` | `[create delete deletecollection get list patch update watch]`\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| Create with schedule | `kubectl create cronjob CRONJOB_NAME --image=busybox --schedule=\"*/1 * * * *\"`|\n| List | `kubectl get cj` or `kubectl get cronjob` or `kubectl get cronjobs` |\n| List in all namespaces | `kubectl get cj --all-namespaces` or `kubectl get cj -A` |\n| List with more information | `kubectl get cj -owide`|\n| Delete | `kubectl delete cj CRONJOB_NAME` or `kubectl delete -f cronjob.yaml`|\n| Get particular cronjob | `kubectl get cj cronjob_NAME` |\n| Verbose Debug information/describe cronjob | `kubectl describe cj/CRRONJOB_NAME` |\n\n### [Service](https://kubernetes.io/docs/concepts/services-networking/service/)\n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `services`  | `svc`  | `-` | `true` | `Service` | `[create delete get list patch update watch]`\n\n| Service Type | Description | Kubectl Command |\n| ------------ | ----------- | --------------- |\n| ClusterIP    | Create service | `kubectl create service clusterip my-cs --tcp=5678:8080` |\n|              | Create service in headless mode | `kubectl create service clusterip my-cs --clusterip=\"None\"` |\n| ExternalName| Create an ExternalName service | `kubectl create service externalname my-ns --external-name example.com` |\n| LoadBalancer | Create a LoadBalancer service | `kubectl create service loadbalancer my-lbs --tcp=5678:8080` |\n| NodePort | Create a NodePort service | `kubectl create service nodeport my-ns --tcp=5678:8080` |\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| List | `kubectl get service` or `kubectl get svc`|\n| List in all namespaces | `kubectl get service --all-namespaces` or `kubectl get svc -A` |\n| List with more information | `kubectl get svc -owide` or `kubectl get service -owide` |\n| Delete | `kubectl delete svc SERVICE_NAME` or `kubectl delete -f service.yaml`|\n| Get particular service | `kubectl get service SERVICE_NAME` |\n| Verbose Debug information/describe service | `kubectl describe svc/SERVICE_NAME` |\n\n### [Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/)\n\n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `namespaces`  | `ns`  | `-` | `false` | `Namespace` | `[create delete get list patch update watch]`\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| List | `kubectl get namespaces` or `kubectl get ns`|\n| Create | `kubectl create ns TEST` |\n| Delete | `kubectl delete ns TEST` or `kubectl delete -f namespace.yaml`|\n| Get particular namespace | `kubectl get ns TEST` |\n| Verbose Debug information/describe service | `kubectl describe ns/TEST` |\n\n### [Serviceaccounts](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/)\n\n| NAME  | SHORTNAMES | APIGROUP | NAMESPACED | KIND | VERBS |\n| ------------- | ------------- | ------- | -------- | --------- | -------- |\n| `serviceaccounts`  | `sa`  | `-` | `true` | `ServiceAccount` | `[create delete deletecollection get list patch update watch]`\n\n| Verb Description | Kubectl Command |\n| ------------- | ------------- |\n| List | `kubectl get sa`|\n| Create | `kubectl create serviceaccount my-service-account` |\n| Delete | `kubectl delete serviceaccount my-service-account` or `kubectl delete -f my-service-account.yaml` |\n| Get particular sa | `kubectl get sa my-service-account` |\n| Verbose Debug information/describe service | `kubectl describe sa/my-service-account` |\n\n### [Node Maintenance](https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/)\n| Description                                      | Command                       |\n|-------------------------------------------| -------------------------------|\n| Mark node as unschedulable                | `kubectl cordon $NODE_NAME`   |\n| Mark node as schedulable                  | `kubectl uncordon $NODE_NAME` |\n| Drain node in preparation for maintenance | `kubectl drain $NODE_NAME`    |\n| Drain node with grace period of 15 mins   | `kubectl drain $NODE_NAME --grace-period=900` |\n| Drain node forcefully | `kubectl drain $NODE_NAME --force` |\n| Ignore DaemonSet-managed pods while draining node | `kubectl drain $NODE_NAME --grace-period=900 --ignore-daemonsets=true` |\n\n### Events\n| Description                            | Command                                                    |\n|---------------------------------| ------------------------------------------------------------|\n| View all events                 | `kubectl get events --all-namespaces` or `kubectl get events -A`  |\n| List Events sorted by timestamp | `kubectl get events --sort-by=.metadata.creationTimestamp`   |\n| List Events only in kube-system namespace | `kubectl get events -n kube-system` |\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladwa%2Fkuberenetes-kubectl-cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladwa%2Fkuberenetes-kubectl-cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladwa%2Fkuberenetes-kubectl-cheatsheet/lists"}