Member-only story

Admin Notebook: How to be quick with kubectl 1.19 [CKA]

Arun Kumar Singh
4 min readOct 18, 2020

--

Photo by Thomas Lipke on Unsplash

Kubernetes admin has to work on multiple things in parallel. Growing popularity on Kubernetes will force you sooner or later to become a ninja quick. In my opinion working with Imperative commands will help you out performing simple task quickly. Examples are as follows:

POD:

kubectl run nginx --image=nginx:latest --restart=Always --dry-run=client# running command
kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c "sleep 3600" --dry-run=client
# resources
kubectl run busybox-pod --image=busybox --requests \ "cpu=500m,memory=1024Mi" --limits "cpu=500m,memory=1024Mi" \
--dry-run=client -o yaml
# labels
kubectl run redis --image=redis:alpine -l tier=db
# Deleting forcefully
kubectl delete pod busybox-pod--grace-period=0 --force

Service:

# expose pod
kubectl expose pod nginx --port=80 --name nginx-service --type=NodePort --dry-run=client -o yaml
# create service
kubectl create service clusterip redis --tcp=6379:6379 --dry-run=client -o yaml

Deployment

# creating deployment
kubectl create deploy nginx-dep --image=nginx:1.16

# image rollout
kubectl set image

--

--

Arun Kumar Singh
Arun Kumar Singh

Written by Arun Kumar Singh

In quest of understanding How Systems Work !

No responses yet