Professional Documents
Culture Documents
Kubernetes 407 Commands
Kubernetes 407 Commands
Kubernetes 407 Commands
https://www.linkedin.com/in/lokeshkumar-aws-devops
Kubernetes Commands
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
Kubernetes Commands
1. kubectl version: Display the client and server Kubernetes version information.
9. kubectl create: Create a resource from a file or from standard input. For example:
13. kubectl delete: Delete resources by name, label, or other filter. For example:
15. kubectl exec: Execute a command inside a running container. For example:
16. kubectl exec -it <pod-name> -- /bin/bash: Start a shell inside a pod.
17. kubectl logs: Retrieve logs from a container in a pod. For example:
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
18. kubectl logs <pod-name>: Retrieve logs from the first container in a pod.
19. kubectl port-forward: Forward one or more local ports to a pod. For example:
20. kubectl port-forward <pod-name> 8080:80: Forward local port 8080 to port 80 in
the pod.
21. kubectl scale: Scale the number of replicas for a deployment or replica set.
25. kubectl config: Manage Kubeconfig files, which store cluster authentication
information.
26. kubectl create secret: Create a secret from literal values, files, or directories.
28. kubectl apply -f: Deploy and manage applications using YAML manifests. Custom
resource definitions (CRDs) and Helm charts are often used for more complex
applications.
29. kubectl edit: Edit a resource in real-time using the default editor.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
33. kubectl rollout history deployment/<deployment-name>: View rollout history of a
deployment.
40. kubectl get events: Retrieve events related to resources in the cluster.
43. kubectl top pods: Show CPU and memory usage for pods.
47. kubectl cp: Copy files and directories to and from pods.
50. kubectl proxy: Start a proxy server for accessing the Kubernetes API locally.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
51. kubectl logs -f: Stream live logs from a container.
62. kubectl top pod <pod-name>: Display CPU and memory usage for a specific pod.
66. kubectl exec -ti: Start an interactive terminal session in a running container.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
69. kubectl rollout undo deployment/<deployment-name>: Roll back a deployment to
the previous revision.
70. kubectl rollout history: View the history of a deployment, including revisions.
72. kubectl get configmaps and kubectl get secrets: List ConfigMaps and Secrets in a
namespace.
75. kubectl explain: Get information about Kubernetes resources and their fields.
77. kubectl create namespace and kubectl delete namespace: Create and delete
Kubernetes namespaces.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
85. kubectl top pod <pod-name>: Display CPU and memory usage for a specific pod.
86. kubectl get pods --selector: List pods based on label selectors.
87. kubectl get pods --selector=<label-selector>: List pods that match a specific label
selector.
90. kubectl rollout history: View the history of a deployment, including revisions.
92. kubectl rollout edit: Edit the YAML of a specific revision of a deployment.
94. kubectl rollout status: Check the status of a specific revision during a rollout.
96. kubectl logs --previous: View logs from the previous version of a container in a
pod.
97. kubectl logs --previous <pod-name>: Display logs from the container that was
running in the previous pod revision.
98. kubectl describe node: Get detailed information about a node in the cluster.
99. kubectl describe node <node-name>: View detailed information about a specific
node, including its resource utilization.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
100. kubectl replace: Replace a resource with a new one based on the provided
YAML.
102. kubectl rollout pause and kubectl rollout resume: Temporarily pause and
resume a deployment rollout.
107. kubectl rollout history and kubectl rollout undo: Manage and undo
revisions of a deployment.
110. kubectl diff: View differences between the applied configuration and the
current state.
111. kubectl diff -f <filename.yaml>: Compare the desired state in a YAML file
with the current state in the cluster.
112. kubectl top node: View resource usage metrics for nodes.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
113. kubectl top node: Display CPU and memory usage for all nodes in the
cluster.
115. kubectl get endpoints <service-name>: View the endpoints associated with
a service.
121. kubectl get namespaces: Display a list of all namespaces in the cluster.
124. kubectl rollout status -w: Watch the status of a deployment rollout in real-
time.
126. kubectl edit configmap and kubectl edit secret: Edit ConfigMaps and
Secrets in real-time.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
129. kubectl get all: List all resources in the current namespace.
130. kubectl get all: List all resources (pods, services, deployments, etc.) in the
current namespace.
131. kubectl logs -c: View logs from a specific container within a pod.
133. kubectl rollout status -w and kubectl rollout undo --dry-run: Dry-run a
rollback to a previous revision.
137. kubectl top pod --all-namespaces: Display resource usage metrics for pods
across all namespaces.
138. kubectl top pod --all-namespaces: Show CPU and memory usage for pods in
all namespaces.
139. kubectl api-resources: List all available resource types in the cluster.
140. kubectl api-resources: List all resource types that are available and
supported in your cluster.
141. kubectl rollout status -w --timeout: Watch a deployment rollout and set a
timeout.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
142. kubectl rollout status -w deployment/<deployment-name> --timeout=300s:
Watch a rollout and stop after a specific timeout (e.g., 300 seconds).
143. kubectl explain --recursive: Recursively explain a resource and its fields.
145. kubectl get events --sort-by: List events and sort them by a specific field.
151. kubectl rollout history --limit=: Limit the number of revisions displayed in a
deployment's rollout history.
153. kubectl rollout status -w and kubectl rollout undo --dry-run: Dry-run a
rollback to a previous revision.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
155. kubectl describe hpa: Describe a Horizontal Pod Autoscaler (HPA) to view
its configuration.
157. kubectl config current-context: Display the name of the current Kubernetes
context.
158. kubectl config current-context: Show the name of the currently active
context in your Kubeconfig.
159. kubectl get storageclass: List storage classes available in the cluster.
160. kubectl get storageclass: View a list of storage classes that can be used for
dynamic provisioning of PersistentVolumes (PVs).
161. kubectl get pv and kubectl get pvc: List PersistentVolumes (PVs) and
PersistentVolumeClaims (PVCs) in the cluster.
163. kubectl get pvc: List all PVCs in the current namespace.
168. kubectl get nodes --show-labels: List nodes and their labels.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
169. kubectl get nodes --show-labels: Display the labels associated with nodes in
the cluster.
170. kubectl top pod --namespace: View resource usage metrics for pods in a
specific namespace.
172. kubectl auth can-i: Check if a user or group has permission to perform a
specific action.
173. kubectl auth can-i create pods --as=<username>: Determine if a user can
create pods.
174. kubectl rollout status --timeout=: Watch a deployment rollout and specify a
timeout.
176. kubectl create role and kubectl create rolebinding: Create roles and role
bindings for RBAC (Role-Based Access Control).
179. kubectl get cronjobs and kubectl get jobs: List CronJobs and Jobs for batch
processing.
180. kubectl get cronjobs: List all CronJobs in the current namespace.
181. kubectl get jobs: List all Jobs in the current namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
182. kubectl rollout status and kubectl rollout undo --to-revision: Rollback to a
specific revision of a deployment.
184. kubectl get endpoints and kubectl get svc: List endpoints for a service.
185. kubectl get endpoints <service-name>: View the endpoints associated with
a specific service.
186. kubectl get svc: List all services in the current namespace.
189. kubectl drain and kubectl cordon: Safely evict pods from a node and mark it
as unschedulable.
190. kubectl drain <node-name>: Safely evict pods from a node for
maintenance.
192. kubectl rollout status -w and kubectl rollout pause and kubectl rollout
resume: Watch a deployment rollout in real-time, pause it, and resume it.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
195. kubectl rollout resume deployment/<deployment-name>: Resume a
paused deployment rollout.
197. kubectl apply -f -: Apply resources read from stdin, which can be useful for
scripting.
198. kubectl top pod --all-namespaces and kubectl top node --all-namespaces:
View resource usage metrics for pods and nodes across all namespaces.
199. kubectl top pod --all-namespaces: Show CPU and memory usage for pods in
all namespaces.
200. kubectl top node --all-namespaces: Display resource usage for nodes in all
namespaces.
203. kubectl set image: Update a container image for a pod template in a
deployment.
205. kubectl rollout history and kubectl rollout undo --revision: View rollout
history and undo to a specific revision of a deployment.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
208. kubectl describe pv and kubectl describe pvc: Describe PersistentVolumes
(PVs) and PersistentVolumeClaims (PVCs) for detailed information.
215. kubectl rollout history --limit=: Limit the number of revisions displayed in a
deployment's rollout history. - kubectl rollout history deployment/<deployment-
name> --limit=<number>: Show a specific number of recent revisions in the
deployment's rollout history.
216. kubectl rollout status -w and kubectl rollout undo --dry-run: Dry-run a
rollback to a previous revision. - kubectl rollout undo deployment/<deployment-
name> --to-revision=<revision-number> --dry-run: Simulate a rollback without
actually performing it.
217. kubectl describe hpa: Describe a Horizontal Pod Autoscaler (HPA) to view
its configuration. - kubectl describe hpa/<hpa-name>: Get detailed information
about an HPA, including its scaling configuration.
218. kubectl config current-context: Display the name of the current Kubernetes
context. - kubectl config current-context: Show the name of the currently active
context in your Kubeconfig.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
219. kubectl get storageclass: List storage classes available in the cluster. -
kubectl get storageclass: View a list of storage classes that can be used for
dynamic provisioning of PersistentVolumes (PVs).
220. kubectl get pv and kubectl get pvc: List PersistentVolumes (PVs) and
PersistentVolumeClaims (PVCs) in the cluster. - kubectl get pv: List all PVs in the
cluster. - kubectl get pvc: List all PVCs in the current namespace.
222. kubectl rollout restart pod: Restart a specific pod. - kubectl rollout restart
pod/<pod-name>: Restart a pod by deleting and recreating it.
223. kubectl get nodes --show-labels: List nodes and their labels. - kubectl get
nodes --show-labels: Display the labels associated with nodes in the cluster.
224. kubectl top pod --namespace: View resource usage metrics for pods in a
specific namespace. - kubectl top pod --namespace=<namespace-name>: Show
CPU and memory usage for pods in a particular namespace.
225. kubectl auth can-i: Check if a user or group has permission to perform a
specific action. - kubectl auth can-i create pods --as=<username>: Determine if a
user can create pods.
226. kubectl rollout status -w and kubectl rollout pause and kubectl rollout
resume: Watch a deployment rollout in real-time, pause it, and resume it. -
kubectl rollout status -w deployment/<deployment-name>: Continuously monitor
the status of a deployment rollout. - kubectl rollout pause
deployment/<deployment-name>: Pause an ongoing deployment rollout. - kubectl
rollout resume deployment/<deployment-name>: Resume a paused deployment
rollout.
227. kubectl apply -f -: Apply resources from standard input (stdin). - kubectl
apply -f -: Apply resources read from stdin, which can be useful for scripting.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
228. kubectl top pod --all-namespaces and kubectl top node --all-namespaces:
View resource usage metrics for pods and nodes across all namespaces. - kubectl
top pod --all-namespaces: Show CPU and memory usage for pods in all
namespaces. - kubectl top node --all-namespaces: Display resource usage for
nodes in all namespaces.
229. kubectl exec -n: Execute a command in a specific namespace. - kubectl exec
-n <namespace> -it <pod-name> -- /bin/bash: Start an interactive shell in a pod in
a specific namespace.
230. kubectl set image: Update a container image for a pod template in a
deployment. - kubectl set image deployment/<deployment-name> <container-
name>=<new-image>: Update the image for a container in a deployment.
231. kubectl rollout history and kubectl rollout undo --revision: View rollout
history and undo to a specific revision of a deployment. - kubectl rollout history
deployment/<deployment-name>: List the rollout history of a deployment. -
kubectl rollout undo deployment/<deployment-name> --revision=<revision-
number>: Roll back a deployment to a specific revision.
233. kubectl rollout status --timeout=: Watch a deployment rollout and set
a timeout. - kubectl rollout status deployment/<deployment-name> --
timeout=<duration>: Watch a rollout and stop after a specified duration (e.g.,
"1m" for 1 minute).
234. kubectl label and kubectl annotate: Add or modify labels and
annotations on resources. - kubectl label pods <pod-name>
<key>=<value>: Add a label to a pod. - kubectl annotate pods <pod-
name> <key>=<value>: Add an annotation to a pod.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
235. kubectl get events --sort-by: List events and sort them by a specific
field. - kubectl get events --sort-by='.metadata.creationTimestamp': List
events sorted by their creation timestamp.
238. kubectl get role and kubectl get rolebinding: List roles and role
bindings in a namespace. - kubectl get role -n <namespace>: List roles in a
specific namespace. - kubectl get rolebinding -n <namespace>: List role
bindings in a specific namespace.
239. kubectl rollout restart and kubectl rollout pause --selector and
kubectl rollout resume --selector: Restart, pause, and resume deployments
with a label selector. - kubectl rollout restart deployment --
selector=<label-selector>: Restart all deployments matching a label selector. -
kubectl rollout pause deployment --selector=<label-selector>: Pause
deployments matching a label selector. - kubectl rollout resume deployment
--selector=<label-selector>: Resume paused deployments matching a label
selector.
240. kubectl apply -k: Apply resources using Kustomize overlays. - kubectl
apply -k <path-to-directory>: Apply resources with Kustomize overlays from a
directory.
241. kubectl get endpoints --selector: List endpoints for services based on
a label selector. - kubectl get endpoints --selector=<label-selector>: List
endpoints for services matching a label selector.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
243. kubectl top pod --all-namespaces and kubectl top node --all-
namespaces: View resource usage metrics for pods and nodes across all
namespaces. - kubectl top pod --all-namespaces: Show CPU and
memory usage for pods in all namespaces. - kubectl top node --all-
namespaces: Display resource usage for nodes in all namespaces.
245. kubectl set image: Update a container image for a pod template in
a deployment. - kubectl set image deployment/<deployment-name>
<container-name>=<new-image>: Update the image for a container in a
deployment.
246. kubectl rollout history and kubectl rollout undo --revision: View
rollout history and perform a rollback to a specific revision of a
deployment. - kubectl rollout history deployment/<deployment-name>:
List the rollout history of a deployment. - kubectl rollout undo
deployment/<deployment-name> --revision=<revision-number>: Roll back
a deployment to a specific revision.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
249. kubectl delete secret: Delete a secret in a namespace. - kubectl
delete secret <secret-name> -n <namespace>: Delete a secret from a
specific namespace.
252. kubectl top apiservice: View resource usage metrics for API
services. - kubectl top apiservice: Display resource usage metrics for API
services if applicable.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
257. kubectl get podsecuritypolicy -n: List PodSecurityPolicies in a
specific namespace. - kubectl get podsecuritypolicy -n <namespace>:
List PodSecurityPolicies within a specified namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
264. kubectl describe customresourcedefinition: Describe a
CustomResourceDefinition to view its configuration. - kubectl describe
customresourcedefinition/<crd-name>: Get detailed information about a
CRD, including its schema.
265. kubectl set env: Set environment variables in a container. - kubectl set
env deployment/<deployment-name> <container-name>
<key>=<value>: Set an environment variable in a container within a
deployment.
266. kubectl describe rolebinding View resource usage metrics for Ingress
resources. - kubectl top ingress: Display resource usage metrics for Ingress
objects if applicable.
267. kubectl get endpoints -n: List endpoints for services in a specific
namespace. - kubectl get endpoints -n <namespace>: List endpoints for
services within a specified namespace.
268. kubectl top cronjob: View resource usage metrics for CronJobs. -
kubectl top cronjob: Display resource usage metrics for CronJob resources if
applicable.
269. kubectl get events -n: List events in a specific namespace. - kubectl
get events -n <namespace>: List events occurring within a specified
namespace.
270. kubectl replace -f: Replace a resource with a new one based on the
provided YAML. - kubectl replace -f <filename.yaml>: Replace an existing
resource with a new one defined in a YAML file.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
272. kubectl scale: Scale the number of replicas for a resource. - kubectl
scale deployment/<deployment-name> --replicas=<number>: Adjust the
number of replicas for a deployment.
274. kubectl get clusterrole -n: List cluster roles in a specific namespace. -
kubectl get clusterrole -n <namespace>: List cluster roles within a specified
namespace.
275. kubectl get role -n: List roles in a specific namespace. - kubectl get
role -n <namespace>: List roles within a specified namespace.
276. kubectl get rolebinding -n: List role bindings in a specific namespace. -
kubectl get rolebinding -n <namespace>: List role bindings within a
specified namespace.
279. kubectl rollout history and kubectl rollout undo --dry-run: View
rollout history and dry-run a rollback to a previous revision of a deployment. -
kubectl rollout history deployment/<deployment-name>: List the rollout
history of a deployment. - kubectl rollout undo deployment/<deployment-
name> --to-revision=<revision-number> --dry-run: Simulate a rollback
without actually performing it.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
280. kubectl top customresourcedefinition: View resource usage metrics
for CustomResourceDefinitions (CRDs). - kubectl top
customresourcedefinition: Display resource usage metrics for CRDs if
applicable.
282. kubectl set env: Set environment variables in a container. - kubectl set
env deployment/<deployment-name> <container-name>
<key>=<value>: Set an environment variable in a container within a
deployment.
283. kubectl top ingress: View resource usage metrics for Ingress resources. -
kubectl top ingress: Display resource usage metrics for Ingress objects if
applicable.
286. kubectl get endpoints -n: List endpoints for services in a specific
namespace.
287. kubectl get endpoints -n <namespace>: List endpoints for services within a
specified namespace.
288. kubectl top cronjob: View resource usage metrics for CronJobs. - kubectl
top cronjob: Display resource usage metrics for CronJob resources if applicable.
289. kubectl get events -n: List events in a specific namespace. - kubectl get
events -n <namespace>: List events occurring within a specified namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
290. kubectl replace -f: Replace a resource with a new one based on the
provided YAML. - kubectl replace -f <filename.yaml>: Replace an existing resource
with a new one defined in a YAML file.
291. kubectl rollout pause and kubectl rollout resume --selector: Pause and
resume deployments with a label selector. - kubectl rollout pause deployment --
selector=<label-selector>: Pause deployments matching a label selector. - kubectl
rollout resume deployment --selector=<label-selector>: Resume paused
deployments matching a label selector.
292. kubectl scale: Scale the number of replicas for a resource. - kubectl scale
deployment/<deployment-name> --replicas=<number>: Adjust the number of
replicas for a deployment.
293. kubectl get clusterrolebinding -n: List cluster role bindings in a specific
namespace. - kubectl get clusterrolebinding -n <namespace>: List cluster role
bindings within a specified namespace.
294. kubectl get clusterrole -n: List cluster roles in a specific namespace. -
kubectl get clusterrole -n <namespace>: List cluster roles within a specified
namespace.
295. kubectl get role -n: List roles in a specific namespace. - kubectl get role -n
<namespace>: List roles within a specified namespace.
296. kubectl get rolebinding -n: List role bindings in a specific namespace. -
kubectl get rolebinding -n <namespace>: List role bindings within a specified
namespace.
297. kubectl describe role -n: Describe a Role resource in a specific namespace. -
kubectl describe role/<role-name> -n <namespace>: Get detailed information
about a Role in a specific namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
298. kubectl describe rolebinding -n: Describe a RoleBinding resource in a
specific namespace. - kubectl describe rolebinding/<rolebinding-name> -n
<namespace>: Get detailed information about a RoleBinding in a specific
namespace.
299. kubectl rollout history and kubectl rollout undo --dry-run: View rollout
history and dry-run a rollback to a previous revision of a deployment. - kubectl
rollout history deployment/<deployment-name>: List the rollout history of a
deployment. - kubectl rollout undo deployment/<deployment-name> --to-
revision=<revision-number> --dry-run: Simulate a rollback without actually
performing it.
302. kubectl set env: Set environment variables in a container. - kubectl set env
deployment/<deployment-name> <container-name> <key>=<value>: Set an
environment variable in a container within a deployment.
303. kubectl top ingress: View resource usage metrics for Ingress resources. -
kubectl top ingress: Display resource usage metrics for Ingress objects if
applicable.
304. kubectl get endpoints -n: List endpoints for services in a specific
namespace. - kubectl get endpoints -n <namespace>: List endpoints for
services within a specified namespace.
305. kubectl top cronjob: View resource usage metrics for CronJobs. -
kubectl top cronjob: Display resource usage metrics for CronJob resources if
applicable.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
306. kubectl get events -n: List events in a specific namespace. - kubectl
get events -n <namespace>: List events occurring within a specified
namespace.
307. kubectl replace -f: Replace a resource with a new one based on the
provided YAML. - kubectl replace -f <filename.yaml>: Replace an existing
resource with a new one defined in a YAML file.
309. kubectl scale: Scale the number of replicas for a resource. - kubectl
scale deployment/<deployment-name> --replicas=<number>: Adjust the
number of replicas for a deployment.
311. kubectl get clusterrole -n: List cluster roles in a specific namespace. -
kubectl get clusterrole -n <namespace>: List cluster roles within a specified
namespace.
312. kubectl get role -n: List roles in a specific namespace. - kubectl get
role -n <namespace>: List roles within a specified namespace.
313. kubectl get rolebinding -n: List role bindings in a specific namespace. -
kubectl get rolebinding -n <namespace>: List role bindings within a
specified namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
315. kubectl describe rolebinding -n: Describe a RoleBinding resource in a
specific namespace. - kubectl describe rolebinding/<rolebinding-name> -
n <namespace>: Get detailed information about a RoleBinding in a specific
namespace.
316. kubectl rollout history and kubectl rollout undo --dry-run: View
rollout history and dry-run a rollback to a previous revision of a deployment. -
kubectl rollout history deployment/<deployment-name>: List the rollout
history of a deployment. - kubectl rollout undo deployment/<deployment-
name> --to-revision=<revision-number> --dry-run: Simulate a rollback
without actually performing it.
319. kubectl set env: Set environment variables in a container. - kubectl set
env deployment/<deployment-name> <container-name>
<key>=<value>: Set an environment variable in a container within a
deployment.
320. kubectl top ingress: View resource usage metrics for Ingress resources. -
kubectl top ingress: Display resource usage metrics for Ingress objects if
applicable.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
322. kubectl describe validatingwebhookconfigurations: Describe a
ValidatingWebhookConfiguration to view its configuration. - kubectl describe
validatingwebhookconfigurations/<webhook-name>: Get detailed
information about a ValidatingWebhookConfiguration, including its settings.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
330. kubectl describe persistentvolume -n: Describe a PersistentVolume
in a specific namespace. - kubectl describe persistentvolume/<pv-name> -
n <namespace>: Get detailed information about a PV in a specific namespace.
333. kubectl top pod -n: View resource usage metrics for pods in a specific
namespace. - kubectl top pod -n <namespace>: Show CPU and memory
usage for pods within a specified namespace.
334. kubectl top node -n: Display resource usage metrics for nodes in a
specific namespace. - kubectl top node -n <namespace>: View resource
usage for nodes within a specified namespace.
337. kubectl top apiservice: View resource usage metrics for API services. -
kubectl top apiservice: Display resource usage metrics for API services if
applicable.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
339. kubectl get podtemplate -n: List PodTemplates in a specific
namespace. - kubectl get podtemplate -n <namespace>: List
PodTemplates within a specified namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
346. kubectl describe resourcequota -n: Describe a ResourceQuota in a
specific namespace. - kubectl describe resourcequota/<resourcequota-
name> -n <namespace>: Get detailed information about a ResourceQuota in
a specific namespace.
347. kubectl get lease -n: List Leases in a specific namespace. - kubectl
get lease -n <namespace>: List Leases within a specified namespace.
353. kubectl get csinodes: List CSINodes in the cluster. - kubectl get
csinodes: List all CSINodes available in the cluster.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
354. kubectl describe csinodes: Describe a CSINode to view its
configuration. - kubectl describe csinodes/<csinode-name>: Get detailed
information about a CSINode, including its settings.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
360. kubectl describe replicasets -n: Describe a ReplicaSet in a specific
namespace. - kubectl describe replicasets/<replicaset-name> -n
<namespace>: Get detailed information about a ReplicaSet in a specific
namespace.
365. kubectl get lease -n: List Leases in a specific namespace. - kubectl
get lease -n <namespace>: List Leases within a specified namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
368. kubectl describe endpoint -n: Describe an Endpoint in a specific
namespace. - kubectl describe endpoint/<endpoint-name> -n
<namespace>: Get detailed information about an Endpoint in a specific
namespace.
371. kubectl get csinodes: List CSINodes in the cluster. - kubectl get
csinodes: List all CSINodes available in the cluster.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
376. kubectl describe customresourcedefinition -n: Describe a
CustomResourceDefinition in a specific namespace. - kubectl describe
customresourcedefinition/<crd-name> -n <namespace>: Get detailed
information about a CRD in a specific namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
383. kubectl get podsecuritypolicy -n: List PodSecurityPolicies in a
specific namespace. - kubectl get podsecuritypolicy -n <namespace>:
List PodSecurityPolicies within a specified namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
390. kubectl get secret -n: List secrets in a specific namespace. - kubectl
get secret -n <namespace>: List secrets within a specified namespace.
397. kubectl get pod -o wide: List pods with additional information,
including node names. - kubectl get pod -o wide: List pods along with
additional details like node names.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
398. kubectl get deployment -o custom-columns: Display custom
columns for deployments. - kubectl get deployment -o custom-
columns=<column-name>:<format>: Show specific columns with custom
formatting for deployments.
402. kubectl get endpoints -n: List endpoints for services in a specific
namespace. - kubectl get endpoints -n <namespace>: List endpoints for
services within a specified namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops
Lokeshkumar
https://www.linkedin.com/in/lokeshkumar-aws-devops
405. kubectl describe limitranges -n: Describe a LimitRange in a specific
namespace. - kubectl describe limitrange/<limitrange-name> -n
<namespace>: Get detailed information about a LimitRange in a specific
namespace.
https://www.linkedin.com/in/lokeshkumar-aws-devops