Commands

Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 3

1 Kubectl get pods

2 Kubectl get pods -o wide


3 Kubectl get nodes
4 Kubectl get nodes -o wide
5 Kubectl get pods --show-labels
6 Kubectl get pods -l=labelkey:labelvalue
7 Kubectl get pods --selector=labelkey:labelvalue
8 Kubectl get replicasets or rs
9 Kubectl get pods -A
10 Kubectl get all
11 Kubectl get deployments
12 Kubectl get services or svc
13 Kubectl get namespaces
14 Kubectl get pods -n namespace name or --namespace
15 Kubectl create namespace names

16 Kubectl config set-context --current --namespace=name


17 Kubectl create deployment name –image=name --replicas=3
18 Kubectl run name --image=name
19 Kubectl expose deployment name –type=NodePort --port=nu
20 Kubectl apply -f filename
21 Kubectl edit -f yamlfile
22 Kubectl create -f filename
23 Kubectl describe pods podname
24 Kubectl get pods --all-namespaces
25 Kubectl get pod p.name -o yaml
26 Kubectl get pod p.name -o yaml > yaml.file
27 Kubectl describe nodes nodename
28 Kubectl get pods –field-selector metadata.name=nameofpod
29 Kubectl get pods –field-selector status.phase=running/pendin
30 Kubectl api-resources

31 Minikube service list


32 Kubectl taint node nodename key=value:NoSchedule (-) to rm
33 Kubectl label node nodename key=value
34 Kubectl label pod podname key=value
35 Kubectl get pods -A (podname with suffix node name) Static pod find command
36 varlib/kubelet/config.yaml/ - cat ----> directory Find Static pod file storage area
37 ssh nodeip (or) minikube ssh Enter into node
38 Kubectl replace - - force -f filename.yaml replace the same pod with new
configuration
39 Kubectl top nodes Cpu , memory nodes
40 Kubectl top podes Cpu, memory pods
41 Kubectl logs podname
42 Kubectl set image deployment/deploymentname
containername=newimagewewanttoset
43 Kubectl rollout status deployment deploymentname
44 Kubectl rollout history deployment/deploname
45 Kubectl rollout undo deployment/deponame

46 Kubectl describe deployments/deponame


47 Kubectl create configmap name –from-literal=App-
color=blue –from-literal=app.size=large
48 Kubectl describe configmaps
49 Kubectl get pods
50 Kubectl create secret generic –from-lietral=key=value --from-
literal=key=value
51 Kubectl get secrets
52 Kubectl describe secrets
53 Kubectl exec podname -it – bin/bash , kubectl exec -n
namespace podname -it -- commands
54 Ps ef | grep “\-\-etcd”
55 Ps -aux | grep authorization
56 Kubectl auth can-i <get/list/(action)> --as dev-user -n name
57 Kubectl get role
58 Kubectl get rolebinding
59 Kubectl get csr
60 Kubectl certificate approve certificatename

61 Kubectl certificate deny certificatename


62 Openssl x509 -in pathtodirectoty –text --noout
63 Kubectl config use-context context-name
64 Kubectl config view
65 Kubectl describe role rolename -n namespace
66 Kubectl api-resources –namespaced=true or false
67 ETCDCTL_API=3 etcdctl
–endpoints=/././././
--ca-cert-file=....
--ca-cert-key=....
--
memberlist
68 ETCDCTL_API=3 etcdctl
–endpoints=/././././
--ca-cert-file=....
--ca-cert-key=....
--
snapshot save filename
69 ETCDCTL_API=3 etcdctl
–endpoints=/././././
--ca-cert-file=....
--ca-cert-key=....
--
snapshot restore filename
70 Snapshot status filename
71 kubectl get clusterroles --no-headers | wc -l To see total length of the list
72 Kubectl create serviceaccounts name
73 Kubectl describe serviceaccount name
74 Kubectl get serviceaccounts
75 Ip link add v-net-0 type bridge

76 Ip link set dev v-net-0 up


77 Ip addr add ip.add./24 dev v-net-0
76 Ip route add destationip via entryipof node
77 ps -aux | grep kubelet | grep container-runtime
78 opt/cni/bin
79 Ls /etc/cni/net.d/ to find network
80 Ip link, ip address, ip address show weave(network name)
81 Ssh controlplane, ssh node01, ip route, ip link, ip addrkubectl
config unset users.sathish
82 Sudo ufw allow ssh
83 Sudo ufw status, verbose, deny, numbered, allow
84 Sudo swapoff -a
85 sudo ~/.kube/config
86 kubectl config get-contexts
87 kubectl config unset users.sathish
88 Kubectl config delete-context context-name

You might also like