0% found this document useful (0 votes)
23 views

Kubernetes 407 Commands

Uploaded by

danielng97007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Kubernetes 407 Commands

Uploaded by

danielng97007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Lokeshkumar

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.

2. kubectl cluster-info: Display cluster information, including the server's URL.

3. kubectl get: Retrieve resources from the cluster. For example:

4. kubectl get pods: List all pods in the current namespace.

5. kubectl get nodes: List all nodes in the cluster.

6. kubectl get services: List all services in the current namespace.

7. kubectl describe: Show detailed information about a resource. For example:

8. kubectl describe pod <pod-name>: Show details about a specific pod.

9. kubectl create: Create a resource from a file or from standard input. For example:

10. kubectl create -f <filename.yaml>: Create a resource defined in a YAML file.

11. kubectl apply: Apply changes to resources by specifying a configuration file.

12. kubectl apply -f <filename.yaml>: Apply changes defined in a YAML file.

13. kubectl delete: Delete resources by name, label, or other filter. For example:

14. kubectl delete pod <pod-name>: Delete a specific pod.

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.

22. kubectl scale deployment <deployment-name> --replicas=<replica-count>: Scale a


deployment.

23. kubectl expose: Create a service for an existing pod or deployment.

24. kubectl expose deployment <deployment-name> --port=<port>: Expose a


deployment as a service.

25. kubectl config: Manage Kubeconfig files, which store cluster authentication
information.

26. kubectl create secret: Create a secret from literal values, files, or directories.

27. kubectl create secret generic <secret-name> --from-literal=<key>=<value>: Create


a secret from literal values.

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.

30. kubectl edit <resource-type> <resource-name>: Open a resource for editing.

31. kubectl rollout: Manage deployments and rollbacks.

32. kubectl rollout status deployment/<deployment-name>: Check the status of a


deployment rollout.

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.

34. kubectl scale: Change the number of replicas for a resource.

35. kubectl scale deployment/<deployment-name> --replicas=<replica-count>: Scale a


specific deployment.

36. kubectl label: Add or modify labels on resources.

37. kubectl label pods <pod-name> <key>=<value>: Add a label to a pod.

38. kubectl annotate: Add or modify annotations on resources.

39. kubectl annotate pods <pod-name> <key>=<value>: Add an annotation to a pod.

40. kubectl get events: Retrieve events related to resources in the cluster.

41. kubectl get events: List events for all resources.

42. kubectl top: View resource usage metrics.

43. kubectl top pods: Show CPU and memory usage for pods.

44. kubectl top nodes: Display resource usage for nodes.

45. kubectl exec -it: Start an interactive shell in a running container.

46. kubectl exec -it <pod-name> --container=<container-name> -- /bin/bash: Start a


shell in a specific container within a pod.

47. kubectl cp: Copy files and directories to and from pods.

48. kubectl cp <local-path> <pod-name>:<remote-path>: Copy a file or directory into


a pod.

49. kubectl proxy: Create a proxy to the Kubernetes API server.

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.

52. kubectl logs -f <pod-name>: Continuously stream logs from a pod.

53. kubectl rollout restart: Restart pods in a deployment.

54. kubectl rollout restart deployment/<deployment-name>: Restart all pods


managed by a deployment.

55. kubectl drain: Safely evict pods from a node.

56. kubectl drain <node-name>: Drain a node for maintenance.

57. kubectl uncordon: Mark a previously drained node as schedulable again.

58. kubectl uncordon <node-name>: Mark a node as schedulable.

59. kubectl taint: Add a taint to a node to repel certain pods.

60. kubectl taint nodes <node-name> key=value:NoSchedule: Add a taint to a node.

61. kubectl top pod: Show resource usage of a specific pod.

62. kubectl top pod <pod-name>: Display CPU and memory usage for a specific pod.

63. kubectl rollout pause/resume: Pause and resume a deployment rollout.

64. kubectl rollout pause deployment/<deployment-name>: Pause a rollout.

65. kubectl rollout resume deployment/<deployment-name>: Resume a paused


rollout.

66. kubectl exec -ti: Start an interactive terminal session in a running container.

67. kubectl exec -ti <pod-name> --container=<container-name> -- /bin/bash: Start an


interactive terminal session in a specific container within a pod.

68. kubectl rollout undo: Rollback to a previous version of a deployment.

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.

71. kubectl rollout history deployment/<deployment-name>: List the revisions and


changes made to a deployment.

72. kubectl get configmaps and kubectl get secrets: List ConfigMaps and Secrets in a
namespace.

73. kubectl get configmaps

74. kubectl get secrets

75. kubectl explain: Get information about Kubernetes resources and their fields.

76. kubectl explain <resource-type>: Display detailed information about a particular


resource type.

77. kubectl create namespace and kubectl delete namespace: Create and delete
Kubernetes namespaces.

78. kubectl create namespace <namespace-name>: Create a new namespace.

79. kubectl delete namespace <namespace-name>: Delete an existing namespace and


its resources.

80. kubectl rollout status: Check the status of a deployment rollout.

81. kubectl rollout status deployment/<deployment-name>: Monitor the status of a


deployment rollout until it's complete.

82. kubectl apply -f URL: Deploy resources from a remote URL.

83. kubectl apply -f https://example.com/my-deployment.yaml: Deploy resources


from a URL.

84. kubectl top pod: Show resource usage of a specific pod.

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.

88. kubectl rollout status: Check the status of a deployment rollout.

89. kubectl rollout status deployment/<deployment-name>: Monitor the status of a


deployment rollout until it's complete.

90. kubectl rollout history: View the history of a deployment, including revisions.

91. kubectl rollout history deployment/<deployment-name>: List the revisions and


changes made to a deployment.

92. kubectl rollout edit: Edit the YAML of a specific revision of a deployment.

93. kubectl rollout edit deployment/<deployment-name> --revision=<revision-


number>: Edit the YAML of a specific revision of a deployment.

94. kubectl rollout status: Check the status of a specific revision during a rollout.

95. kubectl rollout status deployment/<deployment-name> --revision=<revision-


number>: Monitor the status of a specific revision during a deployment 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.

101. kubectl replace -f <filename.yaml>: Replace an existing resource with a new


one defined in a YAML file.

102. kubectl rollout pause and kubectl rollout resume: Temporarily pause and
resume a deployment rollout.

103. kubectl rollout pause deployment/<deployment-name>: Pause a


deployment rollout.

104. kubectl rollout resume deployment/<deployment-name>: Resume a


paused deployment rollout.

105. kubectl config use-context: Switch between Kubernetes clusters defined in


your Kubeconfig.

106. kubectl config use-context <context-name>: Switch to a different


Kubernetes context.

107. kubectl rollout history and kubectl rollout undo: Manage and undo
revisions of a deployment.

108. kubectl rollout history deployment/<deployment-name>: List deployment


rollout history.

109. kubectl rollout undo deployment/<deployment-name> --to-


revision=<revision-number>: Roll back a deployment to a specific revision.

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.

114. kubectl get endpoints: List endpoints for services.

115. kubectl get endpoints <service-name>: View the endpoints associated with
a service.

116. kubectl rollout restart: Restart pods controlled by a deployment.

117. kubectl rollout restart deployment/<deployment-name>: Restart all pods


managed by a deployment.

118. kubectl rollout status: Check the status of a deployment rollout.

119. kubectl rollout status deployment/<deployment-name>: Monitor the status


of a deployment rollout until it's complete.

120. kubectl get namespaces: List all namespaces in the cluster.

121. kubectl get namespaces: Display a list of all namespaces in the cluster.

122. kubectl describe service: Get detailed information about a service.

123. kubectl describe service <service-name>: Retrieve information about a


specific service, including its endpoints.

124. kubectl rollout status -w: Watch the status of a deployment rollout in real-
time.

125. kubectl rollout status -w deployment/<deployment-name>: Continuously


monitor the status of a deployment rollout.

126. kubectl edit configmap and kubectl edit secret: Edit ConfigMaps and
Secrets in real-time.

127. kubectl edit configmap <configmap-name>: Open a ConfigMap for editing.

128. kubectl edit secret <secret-name>: Open a Secret for editing.

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.

132. kubectl logs -c <container-name> <pod-name>: Display logs from a specific


container within a pod that has multiple containers.

133. kubectl rollout status -w and kubectl rollout undo --dry-run: Dry-run a
rollback to a previous revision.

134. kubectl rollout undo deployment/<deployment-name> --to-


revision=<revision-number> --dry-run: Simulate a rollback without actually
performing it.

135. kubectl explain <resource-type>.<field>: Get information about a specific


field within a resource.

136. kubectl explain pod.spec.containers: Explain the 'containers' field within a


pod's specification.

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.

144. kubectl explain pod --recursive: Display a recursive explanation of a pod


and its subfields.

145. kubectl get events --sort-by: List events and sort them by a specific field.

146. kubectl get events --sort-by='.metadata.creationTimestamp': List events


sorted by their creation timestamp.

147. kubectl rollout status --watch=false: Check the status of a deployment


rollout once without watching.

148. kubectl rollout status deployment/<deployment-name> --watch=false: Get


the status of a deployment rollout without continuous monitoring.

149. kubectl rollout history --revision=: View details of a specific revision in a


deployment's rollout history.

150. kubectl rollout history deployment/<deployment-name> --


revision=<revision-number>: Retrieve information about a specific revision in a
deployment's rollout history.

151. kubectl rollout history --limit=: Limit the number of revisions displayed in a
deployment's rollout history.

152. kubectl rollout history deployment/<deployment-name> --limit=<number>:


Show a specific number of recent revisions in the deployment's rollout history.

153. kubectl rollout status -w and kubectl rollout undo --dry-run: Dry-run a
rollback to a previous revision.

154. 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
155. kubectl describe hpa: Describe a Horizontal Pod Autoscaler (HPA) to view
its configuration.

156. kubectl describe hpa/<hpa-name>: Get detailed information about an HPA,


including its scaling 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.

162. kubectl get pv: List all PVs in the cluster.

163. kubectl get pvc: List all PVCs in the current namespace.

164. kubectl describe ingress: Describe an Ingress resource to view its


configuration and routing rules.

165. kubectl describe ingress/<ingress-name>: Retrieve detailed information


about an Ingress resource.

166. kubectl rollout restart pod: Restart a specific pod.

167. kubectl rollout restart pod/<pod-name>: Restart a pod by deleting and


recreating it.

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.

171. kubectl top pod --namespace=<namespace-name>: Show CPU and memory


usage for pods in a particular 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.

175. kubectl rollout status deployment/<deployment-name> --


timeout=<duration>: Watch a rollout and stop after a specified duration (e.g.,
"1m" for 1 minute).

176. kubectl create role and kubectl create rolebinding: Create roles and role
bindings for RBAC (Role-Based Access Control).

177. kubectl create role <role-name> --verb=<verbs> --resource=<resources> --


namespace=<namespace>: Create a role.

178. kubectl create rolebinding <binding-name> --role=<role-name> --


user=<user> --namespace=<namespace>: Create a role binding.

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.

183. kubectl rollout undo deployment/<deployment-name> --to-


revision=<revision-number>: Roll back a deployment to a specific revision.

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.

187. kubectl describe ingress -n: Describe an Ingress resource in a specific


namespace.

188. kubectl describe ingress/<ingress-name> -n <namespace>: Get detailed


information about an Ingress resource in a specific 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.

191. kubectl cordon <node-name>: Mark a node as unschedulable to prevent


new pods from being placed on it.

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.

193. kubectl rollout status -w deployment/<deployment-name>: Continuously


monitor the status of a deployment rollout.

194. kubectl rollout pause deployment/<deployment-name>: Pause an ongoing


deployment rollout.

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.

196. kubectl apply -f -: Apply resources from standard input (stdin).

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.

201. kubectl exec -n: Execute a command in a specific namespace.

202. kubectl exec -n <namespace> -it <pod-name> -- /bin/bash: Start an


interactive shell in a pod in a specific namespace.

203. kubectl set image: Update a container image for a pod template in a
deployment.

204. kubectl set image deployment/<deployment-name> <container-


name>=<new-image>: Update the image for a container in a deployment.

205. kubectl rollout history and kubectl rollout undo --revision: View rollout
history and undo to a specific revision of a deployment.

206. kubectl rollout history deployment/<deployment-name>: List the rollout


history of a deployment.

207. 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
208. kubectl describe pv and kubectl describe pvc: Describe PersistentVolumes
(PVs) and PersistentVolumeClaims (PVCs) for detailed information.

209. kubectl describe pv/<pv-name>: Get detailed information about a PV.

210. kubectl describe pvc/<pvc-name>: Get detailed information about a PVC.

211. kubectl rollout status --watch=false: Check the status of a deployment


rollout once without watching.

212. kubectl rollout status deployment/<deployment-name> --watch=false: Get


the status of a deployment rollout without continuous monitoring.

213. kubectl rollout history --revision=: View details of a specific revision in a


deployment's rollout history.

214. kubectl rollout history deployment/<deployment-name> --


revision=<revision-number>: Retrieve information about a specific revision in a
deployment's rollout history.

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.

221. kubectl describe ingress -n: Describe an Ingress resource in a specific


namespace. - kubectl describe ingress/<ingress-name> -n <namespace>: Get
detailed information about an Ingress resource in a specific 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.

232. kubectl describe pv and kubectl describe pvc: Describe PersistentVolumes


(PVs) and PersistentVolumeClaims (PVCs) for detailed information. - kubectl
describe pv/<pv-name>: Get detailed information about a PV. - kubectl describe
pvc/<pvc-name>: Get detailed information about a PVC.

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.

236. kubectl get serviceaccount: List service accounts in the cluster. -


kubectl get serviceaccount: View a list of service accounts available in the
cluster.

237. kubectl get clusterrole and kubectl get clusterrolebinding: List


cluster roles and cluster role bindings. - kubectl get clusterrole: List all cluster
roles. - kubectl get clusterrolebinding: List all cluster role bindings.

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.

242. kubectl port-forward: Forward a local port to a pod. - kubectl port-


forward <pod-name> <local-port>:<pod-port>: Forward traffic from a local
port to a port on a pod.

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.

244. kubectl exec -n: Execute a command in a specific namespace within


a pod. - kubectl exec -n <namespace> -it <pod-name> -- /bin/bash:
Start an interactive shell in a pod in a specific namespace.

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.

247. kubectl describe pv and kubectl describe pvc: Describe


PersistentVolumes (PVs) and PersistentVolumeClaims (PVCs) to get detailed
information. - kubectl describe pv/<pv-name>: Get detailed information
about a PV. - kubectl describe pvc/<pvc-name>: Get detailed information
about a PVC.

248. kubectl create secret: Create a secret in a namespace. - kubectl


create secret generic <secret-name> --from-literal=<key>=<value> -
n <namespace>: Create a secret with a key-value pair in a specific
namespace.

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.

250. kubectl get endpointslice -n: List EndpointSlices in a specific


namespace. - kubectl get endpointslice -n <namespace>: List
EndpointSlices within a specified namespace.

251. kubectl describe endpointslice -n: Describe an EndpointSlice in a


specific namespace. - kubectl describe endpointslice/<endpointslice-
name> -n <namespace>: Get detailed information about an EndpointSlice in
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.

253. kubectl describe apiservice: Describe an API service to view its


configuration. - kubectl describe apiservice/<apiservice-name>: Get
detailed information about an API service, including its settings.

254. kubectl describe podsecuritypolicy: Describe a PodSecurityPolicy


to view its configuration. - kubectl describe podsecuritypolicy/<psp-
name>: Get detailed information about a PodSecurityPolicy, including its
settings.

255. kubectl get networkpolicy -n: List NetworkPolicies in a specific


namespace. - kubectl get networkpolicy -n <namespace>: List
NetworkPolicies within a specified namespace.

256. kubectl describe networkpolicy -n: Describe a NetworkPolicy in a


specific namespace. - kubectl describe networkpolicy/<networkpolicy-
name> -n <namespace>: Get detailed information about a NetworkPolicy in
a specific namespace.

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.

258. kubectl describe podsecuritypolicy -n: Describe a


PodSecurityPolicy in a specific namespace. - kubectl describe
podsecuritypolicy/<psp-name> -n <namespace>: Get detailed information
about a PodSecurityPolicy in a specific namespace.

259. kubectl get priorityclass -n: List PriorityClasses in a specific


namespace. - kubectl get priorityclass -n <namespace>: List
PriorityClasses within a specified namespace.

260. kubectl describe priorityclass -n: Describe a PriorityClass in a


specific namespace. - kubectl describe priorityclass/<priorityclass-
name> -n <namespace>: Get detailed information about a PriorityClass in a
specific namespace.

261. kubectl get persistentvolume -o json: Retrieve PV information in


JSON format. - kubectl get persistentvolume -o json: Get detailed
information about PVs in JSON format.

262. kubectl rollout history and kubectl rollout undo --to-revision --


dry-run: Dry-run a rollback to a previous revision. - 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.

263. kubectl top customresourcedefinition: View resource usage metrics


for CustomResourceDefinitions (CRDs). - kubectl top
customresourcedefinition: Display resource usage metrics for CRDs if
applicable.

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.

271. 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.

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.

273. 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.

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.

277. 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.

278. 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.

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.

281. kubectl describe customresourcedefinition: Describe a


CustomResourceDefinition to view its configuration. - kubectl describe
customresourcedefinition/<crd-name>: Get detailed information about a
CRD, including its schema.

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.

284. kubectl get componentstatuses: List the status of control plane


components.

285. kubectl get componentstatuses: Display the status of control plane


components such as the API server, controller manager, and scheduler.

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.

300. kubectl top customresourcedefinition: View resource usage metrics for


CustomResourceDefinitions (CRDs). - kubectl top customresourcedefinition:
Display resource usage metrics for CRDs if applicable.

301. kubectl describe customresourcedefinition: Describe a


CustomResourceDefinition to view its configuration. - kubectl describe
customresourcedefinition/<crd-name>: Get detailed information about a CRD,
including its schema.

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.

308. 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.

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.

310. 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.

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.

314. 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
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.

317. kubectl top customresourcedefinition: View resource usage metrics


for CustomResourceDefinitions (CRDs). - kubectl top
customresourcedefinition: Display resource usage metrics for CRDs if
applicable.

318. kubectl describe customresourcedefinition: Describe a


CustomResourceDefinition to view its configuration. - kubectl describe
customresourcedefinition/<crd-name>: Get detailed information about a
CRD, including its schema.

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.

321. kubectl describe mutatingwebhookconfigurations: Describe a


MutatingWebhookConfiguration to view its configuration. - kubectl describe
mutatingwebhookconfigurations/<webhook-name>: Get detailed
information about a MutatingWebhookConfiguration, including its settings.

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.

323. kubectl get customresourcedefinition: List


CustomResourceDefinitions (CRDs) in the cluster. - kubectl get
customresourcedefinition: List all CRDs available in the cluster.

324. 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.

325. kubectl top mutatingwebhookconfigurations: View resource usage


metrics for MutatingWebhookConfigurations. - kubectl top
mutatingwebhookconfigurations: Display resource usage metrics for
MutatingWebhookConfigurations if applicable.

326. kubectl top validatingwebhookconfigurations: View resource usage


metrics for ValidatingWebhookConfigurations. - kubectl top
validatingwebhookconfigurations: Display resource usage metrics for
ValidatingWebhookConfigurations if applicable.

327. kubectl get storageclass -n: List storage classes in a specific


namespace. - kubectl get storageclass -n <namespace>: List storage
classes within a specified namespace.

328. kubectl describe storageclass -n: Describe a StorageClass in a specific


namespace. - kubectl describe storageclass/<storageclass-name> -n
<namespace>: Get detailed information about a StorageClass in a specific
namespace.

329. kubectl get persistentvolume -n: List PersistentVolumes (PVs) in a


specific namespace. - kubectl get persistentvolume -n <namespace>: List
PVs within a specified namespace.

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.

331. kubectl get persistentvolumeclaim -n: List PersistentVolumeClaims


(PVCs) in a specific namespace. - kubectl get persistentvolumeclaim -n
<namespace>: List PVCs within a specified namespace.

332. kubectl describe persistentvolumeclaim -n: Describe a


PersistentVolumeClaim in a specific namespace. - kubectl describe
persistentvolumeclaim/<pvc-name> -n <namespace>: Get detailed
information about a PVC 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.

335. kubectl get endpointslice -n: List EndpointSlices in a specific


namespace. - kubectl get endpointslice -n <namespace>: List
EndpointSlices within a specified namespace.

336. kubectl describe endpointslice -n: Describe an EndpointSlice in a


specific namespace. - kubectl describe endpointslice/<endpointslice-
name> -n <namespace>: Get detailed information about an EndpointSlice in a
specific namespace.

337. kubectl top apiservice: View resource usage metrics for API services. -
kubectl top apiservice: Display resource usage metrics for API services if
applicable.

338. kubectl describe apiservice: Describe an API service to view its


configuration. - kubectl describe apiservice/<apiservice-name>: Get
detailed information about an API service, including its settings.

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.

340. kubectl describe podtemplate -n: Describe a PodTemplate in a


specific namespace. - kubectl describe podtemplate/<podtemplate-name>
-n <namespace>: Get detailed information about a PodTemplate in a
specific namespace.

341. kubectl get replicasets -n: List ReplicaSets in a specific namespace.


- kubectl get replicasets -n <namespace>: List ReplicaSets within a
specified namespace.

342. 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.

343. kubectl get priority -n: List Priorities in a specific namespace. -


kubectl get priority -n <namespace>: List Priorities within a specified
namespace.

344. kubectl describe priority -n: Describe a Priority in a specific


namespace. - kubectl describe priority/<priority-name> -n
<namespace>: Get detailed information about a Priority in a specific
namespace.

345. kubectl get resourcequota -n: List ResourceQuotas in a specific


namespace. - kubectl get resourcequota -n <namespace>: List
ResourceQuotas 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.

348. kubectl describe lease -n: Describe a Lease in a specific namespace.


- kubectl describe lease/<lease-name> -n <namespace>: Get detailed
information about a Lease in a specific namespace.

349. kubectl get endpoint -n: List Endpoints in a specific namespace. -


kubectl get endpoint -n <namespace>: List Endpoints within a specified
namespace.

350. 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.

351. kubectl get limitrange -n: List LimitRanges in a specific namespace.


- kubectl get limitrange -n <namespace>: List LimitRanges within a
specified namespace.

352. kubectl describe limitrange -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.

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.

355. kubectl get customresourcedefinition: List


CustomResourceDefinitions (CRDs) in the cluster. - kubectl get
customresourcedefinition: List all CRDs available in the cluster.

356. kubectl describe customresourcedefinition: Describe a


CustomResourceDefinition to view its configuration. - kubectl describe
customresourcedefinition/<crd-name>: Get detailed information about a
CRD, including its schema.

357. kubectl get podtemplate -n: List PodTemplates in a specific


namespace. - kubectl get podtemplate -n <namespace>: List
PodTemplates within a specified namespace.

358. kubectl describe podtemplate -n: Describe a PodTemplate in a


specific namespace. - kubectl describe podtemplate/<podtemplate-name>
-n <namespace>: Get detailed information about a PodTemplate in a
specific namespace.

359. kubectl get replicasets -n: List ReplicaSets in a specific namespace.


- kubectl get replicasets -n <namespace>: List ReplicaSets within a
specified namespace.

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.

361. kubectl get priority -n: List Priorities in a specific namespace. -


kubectl get priority -n <namespace>: List Priorities within a specified
namespace.

362. kubectl describe priority -n: Describe a Priority in a specific


namespace. - kubectl describe priority/<priority-name> -n
<namespace>: Get detailed information about a Priority in a specific
namespace.

363. kubectl get resourcequota -n: List ResourceQuotas in a specific


namespace. - kubectl get resourcequota -n <namespace>: List
ResourceQuotas within a specified namespace.

364. 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.

365. kubectl get lease -n: List Leases in a specific namespace. - kubectl
get lease -n <namespace>: List Leases within a specified namespace.

366. kubectl describe lease -n: Describe a Lease in a specific namespace.


- kubectl describe lease/<lease-name> -n <namespace>: Get detailed
information about a Lease in a specific namespace.

367. kubectl get endpoint -n: List Endpoints in a specific namespace. -


kubectl get endpoint -n <namespace>: List Endpoints 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.

369. kubectl get limitrange -n: List LimitRanges in a specific namespace.


- kubectl get limitrange -n <namespace>: List LimitRanges within a
specified namespace.

370. kubectl describe limitrange -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.

371. kubectl get csinodes: List CSINodes in the cluster. - kubectl get
csinodes: List all CSINodes available in the cluster.

372. kubectl describe csinodes: Describe a CSINode to view its


configuration. - kubectl describe csinodes/<csinode-name>: Get detailed
information about a CSINode, including its settings.

373. kubectl get customresourcedefinition: List


CustomResourceDefinitions (CRDs) in the cluster. - kubectl get
customresourcedefinition: List all CRDs available in the cluster.

374. kubectl describe customresourcedefinition: Describe a


CustomResourceDefinition to view its configuration. - kubectl describe
customresourcedefinition/<crd-name>: Get detailed information about a
CRD, including its schema.

375. kubectl get customresourcedefinition -n: List


CustomResourceDefinitions (CRDs) in a specific namespace. - kubectl get
customresourcedefinition -n <namespace>: List CRDs within a specified
namespace.

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.

377. kubectl get poddisruptionbudget -n: List PodDisruptionBudgets in


a specific namespace. - kubectl get poddisruptionbudget -n
<namespace>: List PodDisruptionBudgets within a specified namespace.

378. kubectl describe poddisruptionbudget -n: Describe a


PodDisruptionBudget in a specific namespace. - kubectl describe
poddisruptionbudget/<pdb-name> -n <namespace>: Get detailed
information about a PodDisruptionBudget in a specific namespace.

379. kubectl get endpointslice -n: List EndpointSlices in a specific


namespace. - kubectl get endpointslice -n <namespace>: List
EndpointSlices within a specified namespace.

380. kubectl describe endpointslice -n: Describe an EndpointSlice in a


specific namespace. - kubectl describe endpointslice/<endpointslice-
name> -n <namespace>: Get detailed information about an EndpointSlice in
a specific namespace.

381. kubectl get ingress -n: List Ingress resources in a specific


namespace. - kubectl get ingress -n <namespace>: List Ingress resources
within a specified namespace.

382. kubectl describe ingress -n: Describe an Ingress resource in a


specific namespace. - kubectl describe ingress/<ingress-name> -n
<namespace>: Get detailed information about an Ingress resource 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.

384. kubectl describe podsecuritypolicy -n: Describe a


PodSecurityPolicy in a specific namespace. - kubectl describe
podsecuritypolicy/<psp-name> -n <namespace>: Get detailed information
about a PodSecurityPolicy in a specific namespace.

385. kubectl get validatingswebhookconfigurations: List


ValidatingWebhookConfigurations in the cluster. - kubectl get
validatingwebhookconfigurations: List all
ValidatingWebhookConfigurations available in the cluster.

386. kubectl describe validatingswebhookconfigurations: Describe a


ValidatingWebhookConfiguration to view its configuration. - kubectl
describe validatingwebhookconfigurations/<webhook-name>: Get
detailed information about a ValidatingWebhookConfiguration, including
its settings.

387. kubectl get mutatingwebhookconfigurations: List


MutatingWebhookConfigurations in the cluster. - kubectl get
mutatingwebhookconfigurations: List all MutatingWebhookConfigurations
available in the cluster.

388. kubectl describe mutatingwebhookconfigurations: Describe a


MutatingWebhookConfiguration to view its configuration. - kubectl
describe mutatingwebhookconfigurations/<webhook-name>: Get detailed
information about a MutatingWebhookConfiguration, including its settings.

389. kubectl get storageclass -o yaml: Retrieve StorageClass


information in YAML format. - kubectl get storageclass -o yaml: Get
detailed information about StorageClasses in YAML format.

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.

391. kubectl describe secret -n: Describe a secret in a specific


namespace. - kubectl describe secret/<secret-name> -n <namespace>:
Get detailed information about a secret in a specific namespace.

392. kubectl get configmap -n: List ConfigMaps in a specific namespace.


- kubectl get configmap -n <namespace>: List ConfigMaps within a
specified namespace.

393. kubectl describe configmap -n: Describe a ConfigMap in a specific


namespace. - kubectl describe configmap/<configmap-name> -n
<namespace>: Get detailed information about a ConfigMap in a specific
namespace.

394. kubectl get persistentvolume -o yaml: Retrieve PersistentVolume


information in YAML format. - kubectl get persistentvolume -o yaml:
Get detailed information about PersistentVolumes in YAML format.

395. kubectl get persistentvolumeclaim -o yaml: Retrieve


PersistentVolumeClaim information in YAML format. - kubectl get
persistentvolumeclaim -o yaml: Get detailed information about
PersistentVolumeClaims in YAML format.

396. kubectl get service -o json: Retrieve Service information in JSON


format. - kubectl get service -o json: Get detailed information about
Services in JSON format.

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.

399. kubectl describe serviceaccount -n: Describe a ServiceAccount in a


specific namespace. - kubectl describe
serviceaccount/<serviceaccount-name> -n <namespace>: Get detailed
information about a ServiceAccount in a specific namespace.

400. kubectl get hpa -n: List HorizontalPodAutoscalers (HPAs) in a


specific namespace. - kubectl get hpa -n <namespace>: List HPAs within a
specified namespace.

401. kubectl describe hpa -n: Describe a HorizontalPodAutoscaler in a


specific namespace. - kubectl describe hpa/<hpa-name> -n <namespace>:
Get detailed information about an HPA in a specific namespace.

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.

403. kubectl get endpoints -o yaml -n: Retrieve endpoint information in


YAML format for services in a specific namespace. - kubectl get
endpoints -o yaml -n <namespace>: Get detailed endpoint information for
services in YAML format.

404. kubectl get limitranges -n: List LimitRanges in a specific


namespace. - kubectl get limitranges -n <namespace>: List LimitRanges
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.

406. kubectl get quota -n: List ResourceQuotas in a specific namespace.


- kubectl get quota -n <namespace>: List ResourceQuotas within a
specified namespace.

407. kubectl describe quota -n: Describe a ResourceQuota in a specific


namespace. - kubectl describe quota/<quota-name> -n <namespace>: Get
detailed information about a ResourceQuota in a specific namespace.

https://www.linkedin.com/in/lokeshkumar-aws-devops

You might also like