2 min readJun 14, 2020
IMPORTANT KUBERNETES COMMAND:
Regenerate Join command from master Node:
$kubeadm token create — print-join-command
# Open Multiple firewall port.
# Enable multiple firewall port using single command
firewall-cmd --zone=public --permanent --add-port={6443,2379,2380,10250,10251,10252}/tcp#In case anything goes wrong, you can always repeat the process.
Run this on Master and Workers:
$kubeadm reset && rm -rf /etc/cni/net.d# Uninstall Node from Master Node
$kubectl delete node <Name of Node># To evict the pods from the node for maintenance/activity. It will recreate pods in other nodes (if Replicaset). For single pod use option (--force)
$kubectl drain <Node Name> --ignore-daemonsets #Mark node03 as unschedulable but do not remove any apps currently running on it .
$kubectl cordon node03# Delete the pods forcefully.
$kubectl delete pod --grace-period=0 --force --namespace# How many Kube-proxy pod deployed in cluster.
$ kubectl get pods -n kube-system# Get IP range configured for Services within cluster.
$ cat /etc/kubernetes/manifests/kube-apiserver.yaml | grep cluster-ip-range#What type of proxy is the kube-proxy configured to use?
- Check the logs of the kube-proxy pods.
$kubectl logs kube-proxy-ft6n7 -n kube-system# Sort persistent volume based on their capacity.
$kubectl get pv --sort-by=.spec.capacity.storage
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pv-log-4 40Mi RWX Retain Available 21m
pv-log-1 100Mi RWX Retain Available 21m
pv-log-2 200Mi RWX Retain Available 21m
pv-log-3 300Mi RWX Retain Available 21m# Retrieve just the first 2 columns of output and store it in the columns should be named NAME and CAPACITY.
$kubectl get pv --sort-by=.spec.capacity.storage -o=custom-columns=NAME:.metadata.name,CAPACITY:.spec.capacity.storage
NAME CAPACITY
pv-log-4 40Mi
pv-log-1 100Mi
pv-log-2 200Mi
pv-log-3 300Mi