Advertisement
sandervanvugt

CKA day1 july23

Jul 6th, 2023
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.95 KB | None | 0 0
  1. 1 lscpu
  2. 2 free -m
  3. 3 df -h
  4. 4 git clone https://github.com/sandervanvugt/cka
  5. 5 cd cka
  6. 6 ls
  7. 7 ls *sh
  8. 8 ./setup-container.sh
  9. 9 ls *sh
  10. 10 less setup-kubetools-specific-version.sh
  11. 11 ./setup-kubetools-specific-version.sh
  12. 12 sudo ./setup-kubetools-specific-version.sh
  13. 13 history
  14. 14 sudo kubeadm init
  15. 15 vim setup-kubetools-specific-version.sh
  16. 16 ./setup-kubetools-specific-version.sh
  17. 17 sudo ./setup-kubetools-specific-version.sh
  18. 18 sudo kubeadm -h
  19. 19 sudo kubeadm reset
  20. 20 sudo kubeadm init
  21. 21 vim ./setup-kubetools-specific-version.sh
  22. 22 sudo apt remove -y kubelet=1.24.3-00 kubeadm=1.24.3-00 kubectl=1.24.3-00
  23. 23 sudo apt remove -y --allow-change-held-packages kubelet=1.24.3-00 kubeadm=1.24.3-00 kubectl=1.24.3-00
  24. 24 sudo ./setup-kubetools-specific-version.sh
  25. 25 sudo kubeadm init
  26. 26 kubectl get pods -A
  27. 27 less setup-kubetools.sh
  28. 28 kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml
  29. 29 kubectl get pods -n kube-system
  30. 30 kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml
  31. 31 kubectl get nodes
  32. 32 history
  33. 33 kubectl get nodes
  34. 34 ./counter.sh 5
  35. 35 history
  36. 36 git pull
  37. 37 cd ..
  38. 38 rm -rf cka
  39. 39 git clone https://github.com/sandervanvugt/cka
  40. 40 cd cka
  41. 41 cat cluster-setup.txt
  42. 42 kubectl create ns mynamespace
  43. 43 kubectl run task2pod --image=alpine -n mynamespace -- /bin/sh -c 'sleep 3600'
  44. 44 kubectl get ns
  45. 45 kubectl get pods -n mynamespace
  46. 46 source <(kubectl completion bash)
  47. 47 kubectl get pods -n mynamespace -o yaml
  48. 48 kubectl run task2pod2 --image=alpine -n mynamespace -- sleep 3600
  49. 49 kubectl get pods -n mynamespace task2pod2 -o yaml | less
  50. 50 history
  51. 51 vim co3.yaml
  52. 52 vim jc3.yaml
  53. 53 kubectl apply -f jc3.yaml
  54. 54 kubectl get pods
  55. 55 kubectl logs task3pod
  56. 56 kubectl describe pod task3pod
  57. 57 kubectl run dummy --image=busybox --dry-run -o yaml -- sleep 3600
  58. 58 vim jc3.yaml
  59. 59 kubectl delete pod task3pod
  60. 60 kubectl apply -f jc3.yaml
  61. 61 kubectl get pods
  62. 62 history
  63. 63 vim jc3.yaml
  64. 64 kubectl create deployment nginx-ex5 --image=nginx --replicas=2
  65. 65 kubectl get all
  66. 66 kubectl scale deployment nginx-ex5 --replicas 4
  67. 67 kubectl get all
  68. 68 kubectl create ns limited
  69. 69 kubectl create quota -h | less
  70. 70 kubectl create quota --hard pods=3,cpu=100m,memory=500Mi -n limited
  71. 71 kubectl create quota qtest --hard pods=3,cpu=100m,memory=500Mi -n limited
  72. 72 kubectl describe quota -n limited
  73. 73 kubectl describe ns limited
  74. 74 kubectl create deployment nginx --image=nginx --replicas=3 -n limited
  75. 75 kubectl get all -n limited
  76. 76 kubectl get -n limited rs nginx-77b4fdf86c
  77. 77 kubectl describe -n limited rs nginx-77b4fdf86c
  78. 78 kubectl -n limited set resources -h
  79. 79 kubectl -n limited set resources -h | less
  80. 80 kubectl -n limited set resources deploy nginx --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi
  81. 81 kubectl get pods -n limited
  82. 82 kubectl get all -n limited
  83. 83 kubectl describe ns limited
  84. 84 kubectl edit -n limited quota qtest
  85. 85 kubectl get all -n limited
  86. 86 kubectl scale deployment -n limited --replicas 4
  87. 87 kubectl scale deployment nginx -n limited --replicas 4
  88. 88 kubectl scale deployment nginx -n limited --replicas 3
  89. 89 kubectl get all -n limited
  90. 90 vim jh7.txt
  91. 91 kubectl describe ns limited
  92. 92 kubectl run testpod --image=nginx -n limited
  93. 93 vim jh7.txt
  94. 94 kubectl run testpod --image=busybox --dry-run=client -o yaml -n limited -- sleep 3600
  95. 95 kubectl run testpod --image=busybox --dry-run=client -o yaml -n limited -- sleep 3600 > mycode.yaml
  96. 96 kubectl get pods -n limited nginx-8647459fc7-pzlkt
  97. 97 kubectl get pods -n limited nginx-8647459fc7-pzlkt -o yaml
  98. 98 vim mycode.yaml
  99. 99 kubectl apply -f mycode.yaml
  100. 100 historey
  101. 101 history
  102. 102 vim jh7.txt
  103. 103 vim nwpolicy-complete-example.yaml
  104. 104 kubectl apply -f nwpolicy-complete-example.yaml
  105. 105 kubectl expose pod nginx --port=80
  106. 106 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  107. 107 kubectl get pods --show-labels
  108. 108 kubectl label pod busybox access=true
  109. 109 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  110. 110 kubectl get pods --show-labels
  111. 111 kubectl create ns nwp-namespace
  112. 112 vim nwp-lab9-1.yaml
  113. 113 kubectl apply -f nwp-lab9-1.yaml
  114. 114 kubectl expose pod nwp-nginx --port=80
  115. 115 kubectl get svc
  116. 116 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx
  117. 117 kubectl exec -it nwp-busybox -n nwp-namespace -- nslookup nwp-nginx
  118. 118 kubectl get svc,pods -n kube-system
  119. 119 kubectl exec -it nwp-busybox -n nwp-namespace -- nslookup nwp-nginx.default.svc.cluster.local
  120. 120 kubectl get svc
  121. 121 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
  122. 122 vim nwp-lab9-2.yaml
  123. 123 kubectl apply -f nwp-lab9-2.yaml
  124. 124 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
  125. 125 kubectl create deploy busybox --image=busybox -- sleep 3600
  126. 126 kubectl exec -it busybox-c95495658-8jnj5 -- wget --spider --timeout=1 nwp-nginx
  127. 127 kubectl default -f nwp-lab9-2.yaml
  128. 128 kubectl delete -f nwp-lab9-2.yaml
  129. 129 vim jh12.yaml
  130. 130 kubectl apply -f jh12.yaml
  131. 131 kubectl create ns restricted
  132. 132 kubectl apply -f jh12.yaml
  133. 133 kubectl delete -f jh12.yaml
  134. 134 kubectl apply -f jh12.yaml
  135. 135 vim jh12.yaml
  136. 136 kubectl exec -it busybox -- wget --spider --timeout=1 nginx.restricted.svc.cluster.local
  137. 137 kubectl get pods --show-labels
  138. 138 kubectl exec -it busybox-c95495658-8jnj5 -- wget --spider --timeout=1 nginx.restricted.svc.cluster.local
  139. 139 history
  140. 140 ./counter.sh 5
  141. 141 kubectl -h | less
  142. 142 kubectl cordon -h | less
  143. 143 kubectl drain -h | less
  144. 144 kubectl drain worker2
  145. 145 kubectl drain worker2 --ignore-daemonsets --force
  146. 146 kubectl get pods -o wide
  147. 147 kubectl get nodes
  148. 148 kubectl edit worker2
  149. 149 kubectl edit node worker2
  150. 150 kubectl uncordon worker2
  151. 151 kubectl get nodes
  152. 152 kubectl edit node worker2
  153. 153 kubectl get pods -A -o wide
  154. 154 kubectl get ds -A
  155. 155 kubectl get pods -o wide
  156. 156 kubectl create newdep --image=nginx --replicas=5
  157. 157 kubectl create deploy newdep --image=nginx --replicas=5
  158. 158 kubectl get pods -o wide
  159. 159 kubectl scale deploy nginx-ex5 --replicas=1
  160. 160 kubectl scale deploy nginx-ex5 --replicas=4
  161. 161 kubectl get pods -o wide
  162. 162 kubectl label nodes worker2 disktype=ssd
  163. 163 vim selector-pod.yaml
  164. 164 kubectl cordon worker2
  165. 165 kubectl apply -f selector-pod.yaml
  166. 166 kubectl get pods -o wide
  167. 167 kubectl describe pod nginx
  168. 168 kubectl uncordon worker2
  169. 169 kubectl get pods -o wide
  170. 170 kubectl edit node control
  171. 171 kubectl get pods -n kube-system -o wide
  172. 172 kubectl edit -n kube-system pod coredns-5d78c9869d-
  173. 173 kubectl edit -n kube-system pod coredns-5d78c9869d-2brbt
  174. 174 kubectl taint nodes worker1 example-key=value1:NoSchedule
  175. 175 kubectl describe node worker1
  176. 176 kubectl describe node worker1 | less
  177. 177 kubectl create deploy nginx-taint --image=nginx --replicas=5
  178. 178 kubectl get pods -o wide
  179. 179 kubectl delete deploy nginx-taint
  180. 180 vim taint-toleration.yaml
  181. 181 kubectl create -f taint-toleration.yaml
  182. 182 kubectl get pods -o wide
  183. 183 kubectl delete -f taint-toleration.yaml
  184. 184 vim taint-toleration.yaml
  185. 185 kubectl describe node worker1
  186. 186 vim taint-toleration.yaml
  187. 187 kubectl create -f taint-toleration.yaml
  188. 188 history
  189.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement