Show Menu
Cheatography

Glossary

pod
Group of containers that are deployed together on the same host
service
Abstra­ction which defines a logical set of pods and a policy by which to access them
node
Worker machine in the cluster
configmap
Public config­uration data in the form of a key-value pair
secret
Private config­uration data
job
Creates pod(s) and ensures that a specified number succes­sfully terminate
cronjob
Time-based job
ingress
API object that manages external access to the services in a cluster, typically HTTP.
deployment
Desired state of pods for declar­ative updates
daemonset
Specif­ication that requires a particular pod to be run on some or all nodes
replicaset
Requir­ement that a specified number of pods are running at any given time
persis­ten­tvolume
Persistent storage in the cluster with an indepe­ndent lifecycle
persis­ten­tvo­lum­eclaim
Request for storage (for a
Persis­ten­tVolume
) by a user

Cluster Management

kubectl proxy
Proxy the api server API to your local machine on port 8001
kubectl port-f­orward {pod_name} {local­_port}: {remot­e_port}
Forward the pod port to your local port
kubectl scale --repl­icas=3 {resou­rce­_ty­pe}­/{r­eso­urc­e_name }
Scale given resource
 

Viewing Objects

kubectl get --all-­nam­espaces {objec­t_type}
Get objects from all namespaces
kubectl describe {objec­t_type}
Describes the given objects
kubectl get services --sort­-by­=.m­eta­dat­a.name
List services sorted by name
kubectl get pods --fiel­d-s­ele­cto­r=s­tat­us.p­ha­se=­Running
Get list of running pods
kubectl get events
Show events

Modifying Objects

kubectl apply -f ./myma­nif­est.yaml
Apply a config­uration to a object by filename or stdin. Also overrides the existing config­ura­tion.
kubectl create -f ./myma­nif­est.yaml
Create object(s)
kubectl create -f ./dir
Create object(s) in all manifest files in dir
kubectl create -f https:­//g­it.i­o/vPi eo
Create from url
kubectl run nginx --imag­e=nginx
Start a single instance of nginx
kubectl replace -- force -f ./pod.json
Force replace, delete and then re-create the resource. Will cause a service outage.
kubectl edit svc/do­cke­rre­gistry
Edit the service named docker­-re­gistry
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Kubectl Cheat Sheet