Difference between revisions of "Kubectl"

From John Freier
Jump to: navigation, search
(Created page with "Kubectl is an application that interacts with Kubernetes clusters.")
 
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Kubectl is an application that interacts with Kubernetes clusters.
 
Kubectl is an application that interacts with Kubernetes clusters.
 +
 +
'''Check the context'''
 +
 +
This checks who kubectl is connected to.
 +
  kubectl config current-context
 +
 +
 +
'''Apply a configuration yaml file.'''
 +
  kubectl apply -f [name_of_file]
 +
 +
 +
== Deploy ==
 +
'''Get Deployments'''
 +
  kubectl get deployments --namespace=cs
 +
 +
 +
'''Delete Deployments'''
 +
  kubectl delete deployment [name_of_deployment] --namespace=cs
 +
 +
 +
 +
== Pods ==
 +
'''Get Pods'''
 +
 +
This gets all the pods.
 +
  kubectl get pods --namespace cs
 +
 +
 +
Delete a pod
 +
  kubectl delete pod [pod_name]
 +
 +
== Volume ==
 +
 +
List Persistent Volumes Claims
 +
  kubectl describe pvc --namespace=cs
 +
 +
 +
== Logs ==
 +
Get the logs from a pod.
 +
  kubectl logs -p [pod_name] --namespace=cs

Latest revision as of 15:24, 12 April 2022

Kubectl is an application that interacts with Kubernetes clusters.

Check the context

This checks who kubectl is connected to.

 kubectl config current-context


Apply a configuration yaml file.

 kubectl apply -f [name_of_file]


Deploy

Get Deployments

 kubectl get deployments --namespace=cs


Delete Deployments

 kubectl delete deployment [name_of_deployment] --namespace=cs


Pods

Get Pods

This gets all the pods.

 kubectl get pods --namespace cs


Delete a pod

 kubectl delete pod [pod_name]

Volume

List Persistent Volumes Claims

 kubectl describe pvc --namespace=cs


Logs

Get the logs from a pod.

 kubectl logs -p [pod_name] --namespace=cs