Kubernetes Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* kubectl commands: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
=Internal=
=Internal=


Line 10: Line 14:
* <span id='Namespace_Operations'></span>[[Kubernetes Namespace Operations|Namespace Operations]]
* <span id='Namespace_Operations'></span>[[Kubernetes Namespace Operations|Namespace Operations]]
* <span id='Pod_Operations'></span>[[Kubernetes Pod Operations|Pod Operations]]
* <span id='Pod_Operations'></span>[[Kubernetes Pod Operations|Pod Operations]]
* <span id='Node_Operations'></span>[[Kubernetes Node Operations|Node Operations]]
* <span id='Deployment_Operations'></span>[[Kubernetes Deployment Operations|Deployment Operations]]
* <span id='StatefulSet_Operations'></span>[[Kubernetes StatefulSet Operations|StatefulSet Operations]]
* <span id='Secrets_Operations'></span>[[Kubernetes Secrets Operations|Secrets Operations]]
* <span id='Secrets_Operations'></span>[[Kubernetes Secrets Operations|Secrets Operations]]
* <span id='ConfigMap_Operations'></span>[[Kubernetes ConfigMap Operations|ConfigMap Operations]]
* <span id='Namespace_Operations'></span>[[Kubernetes Namespace Operations|Namespace Operations]]
* <span id='Security_Operations'></span>[[Kubernetes Security Operations|Security Operations]]
** [[Kubernetes_User_Operations|User Operations]]
** <span id='Service_Account_Operations'></span>[[Kubernetes Service Account Operations|Service Account Operations]]
** [[Kubernetes RBAC Operations|RBAC Operations]]
* [[Kubernetes and curl]]
* <span id='Storage_Operations'></span><span id='Peristence_Operations'></span>[[Kubernetes Storage Operations|Storage Operations]]
* <span id='Service_Operations'></span>[[Kubernetes Service Operations|Service Operations]]
* [[Kubernetes DNS Operations|DNS Operations]]
* [[Kubernetes Dashboard Operations]]


=Runtimes=
=Runtimes=
Line 16: Line 34:
* [[Docker Desktop Kubernetes Support]]
* [[Docker Desktop Kubernetes Support]]
* [[minikube]]
* [[minikube]]
* [[MicroK8s]]
* [[Managed Kubernetes]]
** [[Managed_Kubernetes#AWS_Elastic_Kubernetes_Services_.28EKS.29|Managed Kubernetes &#124; AWS Elastic Kubernetes Services (EKS)]]
** [[Managed_Kubernetes#Azure_Kubernetes_Services_.28AKS.29|Managed Kubernetes &#124; Azure Kubernetes Services (AKS)]]
** [[Managed_Kubernetes#Google_Kuberentes_Engine_.28GKE.29|Managed Kubernetes &#124; Google Kuberentes Engine (GKE)]]
* [[OpenShift]]


=Namespace Operations=
=Troubleshooting=
 
* [[Kubernetes DNS Operations#Troubleshooting_DNS_Resolution|Troubleshooting DNS resolution]]
kubectl get namespaces|ns
 
kubectl delete namespace|ns <''namespace-name''>
 
=Pod Operations=
 
kubectl get pods|po
 
kubectl describe pod <''pod-name''>
 
kubectl log <''pod-name''>
 
=To Redistribute=
 
==Get the Manifest for an Existing Object==
 
The manifest can be used to recreate the object:
 
kubectl get pod ''pod-name'' --export -o yaml
 
Note that --export is deprecated and will be removed in the future so find an equivalent.
 
==Kill Immediately==
 
kubectl delete -n my-ns pod my-pod --force --grace-period=0
 
==Logging==
 
"Tail" logging:
 
kubectl -n my-namespace logs -f my-pod
 
Logging that survives pod restart:
 
while ! kubectl -n my-namespace logs -f my-pod; do sleep 1; done
 
==Port Fowarding==
 
  while ! kubectl -n my-namespace port-forward service/my-service 8787:8787; do sleep 1; done
 
==Get an Individual Attribute Only==
 
https://gist.github.com/so0k/42313dbb3b547a0f51a547bb968696ba
 
kubectl ... -o jsonpath="{.status.phase}"
 
kubectl ... -o jsonpath="{.items[?(@.spec.unschedulable)].metadata.name}"

Latest revision as of 23:01, 28 December 2020