sandervanvugt

CKAD march22 day1

Mar 30th, 2022
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.83 KB | None | 0 0
  1. [sudo] password for student:
  2. root@worker1:~# history
  3. 1 git clone https://github.com/sandervanvugt/cka
  4. 2 cd cka
  5. 3 ./setup-container.sh
  6. 4 ./setup-kubetools.sh
  7. 5 kubeadm join 192.168.29.138:6443 --token y8o8ro.7s54dcqkvidmqrkg --discovery-token-ca-cert-hash sha256:ebf8e84beee89cc71e6cfcf17c3772bfdf49149d1a8efe71ddeee5f623bee313
  8. 6 mkdir /etc/kubernetes/static
  9. 7 cd /etc/kubernetes/static/
  10. 8 vim auto-web.yaml
  11. 9 ps aux | grep kubelet
  12. 10 cd /etc/kubernetes/
  13. 11 ls
  14. 12 cat kubelet.conf
  15. 13 ps aux | grep kubelet
  16. 14 vim /var/lib/kubelet/config.yaml
  17. 15 ls manifests/
  18. 16 systemctl restart kubelet
  19. 17 exit
  20. 18 history
  21. root@worker1:~# grep taticPod /var/lib/kubelet/config.yaml
  22. staticPodPath: /etc/kubernetes/static
  23.  
  24.  
  25. student@control:~/cka$ history
  26. 1 cat /etc/hosts
  27. 2 free -m
  28. 3 sudo vim /etc/fstab
  29. 4 swapoff /swap.img
  30. 5 sudo swapoff /swap.img
  31. 6 free -m
  32. 7 sudo -i
  33. 8 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  34. 9 sudo chown $(id -u):$(id -g) $HOME/.kube/config
  35. 10 kubectl get all
  36. 11 kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
  37. 12 kubectl get ns
  38. 13 kubectl get pods -A
  39. 14 cat /tmp/todo.txt
  40. 15 kubectl get nodes
  41. 16 history
  42. 17 git clone https://github.com/sandervanvugt/cka
  43. 18 cka/counter.sh 15
  44. 19 cd cka
  45. 20 ls
  46. 21 ./counter.sh 15
  47. 22 sudo -i
  48. 23 kubectl get nodes
  49. 24 history
  50. 25 wget https://docs.projectcalico.org/manifests/calico.yaml
  51. 26 vim calico.yaml
  52. 27 kubectl get daemonset
  53. 28 kubectl get daemonset -A
  54. 29 kubectl get pods -A
  55. 30 kubectl get pods -A -o wide
  56. 31 kubectl get pods -A -o wide | grep calico
  57. 32 history
  58. 33 kubectl create ns mynamespace
  59. 34 kubectl run alpine --image=alpine -- sleep 3600 -n mynamespace
  60. 35 kubectl get pods -A
  61. 36 kubectl run alpine --image=alpine -n mynamespace -- sleep 3600
  62. 37 kubectl get pods -A
  63. 38 kubectl completion -h
  64. 39 source <(kubectl completion bash)
  65. 40 kubectl describe pod alpine
  66. 41 kubectl logs alpine
  67. 42 kubectl run alpine --image=alpine -- sleep 3600 -n mynamespace
  68. 43 kubectl delete pod alpine
  69. 44 ./counter.sh 15
  70. 45 vim bi-doesnwork.yaml
  71. 46 kubectl create -f bi-doesnwork.yaml
  72. 47 kubectl get all
  73. 48 kubectl get pods -A
  74. 49 history | grep calico
  75. 50 ./counter.sh 5
  76. 51 vim knabc.yaml
  77. 52 vim ex4.yaml
  78. 53 kubectl run blah --image=busybox --dry-run=client -o yaml -- mkdir /data; touch /data/myfile.txt
  79. 54 kubectl run blah --image=busybox --dry-run=client -o yaml -- "mkdir /data; touch /data/myfile.txt"
  80. 55 vim ex4.yaml
  81. 56 kubectl create -f ex4.yaml
  82. 57 kubectl get pods
  83. 58 kubectl delete -f ex4.yaml
  84. 59 vim ex4.yaml
  85. 60 kubectl create -f ex4.yaml
  86. 61 kubectl get pods
  87. 62 kubectl describe pod init-demo
  88. 63 vim ex4.yaml
  89. 64 kubectl delete pod init-demo
  90. 65 kubectl create -f ex4
  91. 66 kubectl create -f ex4.yaml
  92. 67 kubectl get pods
  93. 68 kubectl describe pod init-demo
  94. 69 kubectl delete pod init-demo
  95. 70 vim ex4.yaml
  96. 71 kubectl create -f ex4.yaml
  97. 72 kubectl get pods
  98. 73 kubectl describe pod init-demo
  99. 74 kubectl delete pod init-demo
  100. 75 vim ex4.yaml
  101. 76 kubectl create -f ex4.yaml
  102. 77 kubectl get pods
  103. 78 kubectl delete pod init-demo
  104. 79 vim ex4.yaml
  105. 80 kubectl create -f ex4.yaml
  106. 81 kubectl get pods
  107. 82 vim ex4.yaml
  108. 83 kubectl describe pod init-demo
  109. 84 vim ex4.yaml
  110. 85 kubectl delete pod init-demo
  111. 86 kubectl create -f ex4.yaml
  112. 87 kubectl get pods
  113. 88 vim ex4.yaml
  114. 89 ./counter.sh 18
  115. 90 ./counter.sh 7
  116. 91 sudo -i
  117. 92 kubectl get pods
  118. 93 kubectl --help | less
  119. 94 kubectl cordon --help | less
  120. 95 kubectl drain --help | less
  121. 96 kubectl get pods -A
  122. 97 kubectl get pods -A -o wide
  123. 98 kubectl drain worker2
  124. 99 kubectl drain worker2 --ignore-daemonsets --force
  125. 100 kubectl get pods -o wide -A
  126. 101 kubectl describe node worker2
  127. 102 kubectl describe node worker2 | less
  128. 103 kubectl get nodes
  129. 104 kubectl uncordon worker2
  130. 105 ./counter.sh 12
  131. 106 ./counter.sh 5
  132. 107 kubectl get nodes
  133. 108 ls -l ~/.kube/
  134. 109 sudo cp /etc/kubernetes/admin.conf ~/.kube/config
  135. 110 ls -l ~/.kube/
  136. 111 chown student:student ~/.kube/config
  137. 112 sudo chown student:student ~/.kube/config
  138. 113 ls -l ~/.kube/
  139. 114 kubectl get nodes
  140. 115 kubectl edit node control
  141. 116 kubectl create deploy --image=nginx --replicas=3 tttest
  142. 117 kubectl get pods -o wide
  143. 118 kubectl config view
  144. 119 vim ~/.kube/config
  145. 120 kubectl label nodes worker2 disktype=ssd
  146. 121 kubectl get nodes --show-labels
  147. 122 vim selector-pod.yaml
  148. 123 kubectl apply -f selector-pod.yaml
  149. 124 kubectl get pods -o wide
  150. 125 kubectl delete pod nginx
  151. 126* kubectl label node worker2 disktype=ssd
  152. 127 kubectl edit node worker2
  153. 128 kubectl apply -f selector-pod.yaml
  154. 129 kubectl get pods
  155. 130 kubectl describe pod nginx
  156. 131 kubectl label nodes worker2 disktype=ssd
  157. 132 kubectl get pods
  158. 133 kubectl get daemonset
  159. 134 kubectl get daemonset -A
  160. 135 kubectl get daemonset -n kube-system calico-node -o yaml | less
  161. 136 kubectl taint nodes worker1 example-key=value1:NoSchedule
  162. 137 kubectl describe nodes worker1 | less
  163. 138 kubectl create deploy nginx-taint --image=nginx --replicas=3
  164. 139 kubectl get pods --selector app=nginx-taint
  165. 140 kubectl get pods --selector app=nginx-taint -o wide
  166. 141 vim taint-toleration.yaml
  167. 142 kubectl create -f taint-toleration.yaml
  168. 143 kubectl get pods -o wide | grep tolera
  169. 144 kubectl get pods -o wide
  170. 145 ./counter.sh 5
  171. 146 kubectl edit node worker1
  172. 147 history
  173.  
Advertisement
Add Comment
Please, Sign In to add comment