Image credit: unsplash.com

Abbreviations

  • deploy — deployments, deployment
  • netpol — networkpolicy
  • rs — replicaset, replicasets
  • cj — cronjob
  • pv — persistent volume
  • pvc — persistent volume claim

Setting up alias and autocompletion with alias

source <(kubectl completion bash | sed ‘s/kubectl/k/g’)

View current context

Core Concepts

Set image of pod nginx : image name is nginx and correct value is nginx

Force delete a pod

Verbosity level of information: level — v=0 till — v=9

Get custom columns in pod summary. Notation is similar to jsonpath notation. File can also be used with custom-columns-file

Get pod field details using jsonpath notation. File can also be used with jsonpath-file

Sort pod summary by name

Sort pod summary by timestamp

Logging and Debugging

Get log dump of a pod

Tail logs of a pod or follow logs

Get logs of a container in multi container pod

Get previous logs of a container

Node and pod meterics. Below commands only run if metric server is installed.

Sumit Sachdeva

I got to where I am today by being me.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store