Ben Clayton Tech

Just a bunch of random stuff

DevopsKubernetes

Kubernetes Tips

  • kubectl get pods -n (namespace) | grep -v Running | grep -v Completed  – This will get a list of pods in a problem state.
  • kubectl describe pod (pod name) -n (namespace) – This will get additional info on the pod
  • kubectl get pods -n (namespace) –sort-by=.status.startTime – This will list pods by age
  • watch ‘kubectl get pods -n (namespace) | grep -v Running | grep -v Completed’ This will watch the pods come up and show which ones aren’t running or completed 
  • kubectl config use-context ## Switch the current context – a context is a set of Kubernetes resources or a cluster
  • kebectl get services  This will list all the services in the namespace
  • kubectl get pods –all-namespaces ##This will get all the pods in all the namespaces in a specific context

  • kubectl cluster-info  Get the information on the cluster
  • kubectl get nodes   Get the information on the nodes on the backend
  • kubectl create deployment (name) –image=repo/container
  • kubectl expose deployment (name) –port=80 –type=Nodeport
  • kubectl cluster-info dump  Dumps a ton of information about the cluster

I just completed the Launch Single Node Kubernetes Cluster scenario on Katacoda! https://www.katacoda.com/courses/kubernetes/launch-single-node-cluster

 

Share this post

Leave a Reply

Your email address will not be published.