sandervanvugt

ignore_me

Oct 20th, 2021
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.71 KB | None | 0 0
  1. student@control:~$ history
  2. 1 kubectl create deploy nginx --image=nginx --dry-run -o yaml | sed '/null\|{}\|replicas/d;/status/,$d;s/Deployment/DaemonSet/g' > nginx-ds.yaml
  3. 2 vim nginx-ds.yaml
  4. 3 kubectl get ds
  5. 4 kubectl delete ds nginx-ds
  6. 5 kubectl create -f nginx-ds.yaml
  7. 6 kubectl delete -f nginx-ds.yaml
  8. 7 cd cka/
  9. 8 vim wg2.yaml
  10. 9 exit
  11. 10 sudo vim /etc/hosts
  12. 11 cat /etc/hosts
  13. 12 sudo apt install vim git bash-completion -y
  14. 13 git clone https://github.com/sandervanvugt/cka
  15. 14 cd cka
  16. 15 ls
  17. 16 vim setup-container.sh
  18. 17 ./setup-container.sh
  19. 18 ls
  20. 19 vim setup-kubetools.sh
  21. 20 vim setup-kubetools-ubuntu.sh
  22. 21 ./setup-kubetools-ubuntu.sh
  23. 22 history
  24. 23 cat /etc/hosts
  25. 24 sudo kubeadm init --help
  26. 25 sudo kubeadm init --pod-network-cidr=10.10.0.0/16
  27. 26 mkdir -p $HOME/.kube
  28. 27 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  29. 28 sudo chown $(id -u):$(id -g) $HOME/.kube/config
  30. 29 kubectl get all
  31. 30 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
  32. 31 kubectl get nodes
  33. 32 kubectl create testginx --image=nginx --replicas=3
  34. 33 kubectl create deploy testginx --image=nginx --replicas=3
  35. 34 kubectl get all
  36. 35 ls
  37. 36 history
  38. 37 ls
  39. 38 ./counter.sh 15
  40. 39 kubectl completion -h
  41. 40 source <(kubectl completion bash)
  42. 41 kubectl create namespace mynamespace
  43. 42 kubectl get ns
  44. 43 kubectl run mypod --image=alpine -n mynamespace -- sleep 3600
  45. 44 kubectl get pods mypod -n mynamespace -o yaml | less
  46. 45 history
  47. 46 ./counter.sh 15
  48. 47 vim wg.yaml
  49. 48 kubectl apply -f wg.yaml
  50. 49 kubectl get all
  51. 50 kubectl describe pod myapp-pod
  52. 51 history
  53. 52 ./counter.sh
  54. 53 vim nrv.yaml
  55. 54 kubectl apply -f nrv.yaml
  56. 55 kubectl get pods
  57. 56 kubectl describe pod ex3
  58. 57 kubectl delete pod ex3
  59. 58 ls -lrt
  60. 59 vim nrv.yaml
  61. 60 kubectl run busybox --image=busybox --dry-run=client -o yaml -- sleep 3600
  62. 61 vim aj.yaml
  63. 62 kubectl create -f aj.yaml
  64. 63 kubectl delete -f aj.yaml
  65. 64 kubectl create -f aj.yaml
  66. 65 kubectl get pods
  67. 66 kubectl describe myapp-pod
  68. 67 kubectl describe pod myapp-pod
  69. 68 kubectl logs myapp-pod
  70. 69 kubectl describe pod myapp-pod
  71. 70 ./counter.sh 5
  72. 71 vim wg2.yaml
  73. 72 kubectl create -f wg2.yaml
  74. 73 kubectl get all
  75. 74 kubectl get pod -o wide
  76. 75 vim svv.yaml
  77. 76 kubectl create -f svv.yaml
  78. 77 kubectl create deploy nginx --image=nginx --dry-run -o yaml | \ sed '/null\|{}\|replicas/d;/status/,$d;s/Deployment/DaemonSet/g' > nginx-ds.yaml kubectl apply -f nginx-ds.yaml
  79. 78 sudo apt install sed
  80. 79 kubectl create deploy nginx --image=nginx --dry-run -o yaml | \ sed '/null\|{}\|replicas/d;/status/,$d;s/Deployment/DaemonSet/g' > nginx-ds.yaml kubectl apply -f nginx-ds.yaml
  81. 80 kubectl create deploy nginx --image=nginx --dry-run -o yaml > nginx-ds.yaml
  82. 81 vim nginx-ds.yaml
  83. 82 kubectl create -f nginx-ds.yaml
  84. 83 vim nginx-ds.yaml
  85. 84 kubectl create -f nginx-ds.yaml
  86. 85 ./counter.sh 25
  87. 86 kubectl create deploy nginx --image=nginx --dry-run -o yaml | sed '/null\|{}\|replicas/d;/status/,$d;s/Deployment/DaemonSet/g' > nginx-ds.yaml
  88. 87 vim nginx-ds.yaml
  89. 88 ls -lrt
  90. 89 vim ex18.yaml
  91. 90 cd /etc/kubernetes/
  92. 91 ls
  93. 92 cd manifests/
  94. 93 ls
  95. 94 vim kube-scheduler.yaml
  96. 95 sudo vim kube-scheduler.yaml
  97. 96 ssh worker1
  98. 97 cd
  99. 98 kubectl run auto-web --image=nginx --dry-run=client -o yaml > auto-web.yaml
  100. 99 cat auto-web.yaml
  101. 100 kubectl get pods -o wide
  102. 101 kubectl create ns limited
  103. 102 kubectl create quota --help
  104. 103 kubectl create quota qtest --hard pods=3,cpu=100,memory=500Mi -n limited
  105. 104 kubectl describe ns limited
  106. 105 kubectl create deploy nginx --image=nginx --replicas=3 -n limited
  107. 106 kubectl get all -n limited
  108. 107 kubectl describe -n limited rs nginx-6799fc88d8
  109. 108 kubectl get all -n limited
  110. 109 kubectl set resources -h | less
  111. 110 kubectl set resources deploy nginx --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi -n limited
  112. 111 kubectl get all -n limited
  113. 112 kubectl scale deploy nginx --replicas=5 -n limited
  114. 113 kubectl get all -n limited
  115. 114 kubectl describe ns limited
  116. 115 kubectl describe -n limited rs nginx-86d467bc98
  117. 116 kubectl delete deploy nginx -n limited
  118. 117 kubectl set resources deploy nginx --limits cpu=200m,memory=1Mi -n limited
  119. 118 kubectl create deploy nginx
  120. 119 kubectl create deploy nginx --image=nginx -n limited
  121. 120 kubectl set resources deploy nginx --limits cpu=200m,memory=1Mi -n limited
  122. 121 kubectl get deploy nginx -n limited -o yaml > oom.yaml
  123. 122 kubectl delete deploy nginx
  124. 123 kubectl delete deploy nginx -n limited
  125. 124 vim oom.yaml
  126. 125 kubectl create -f oom.yaml
  127. 126 kubectl get all -n limited
  128. 127 kubectl describe -n limited pod nginx-566bfb9779-ll295
  129. 128 history
  130. 129 sleep 120; cka/counter.sh 13
  131. 130 kubectl get nodes
  132. 131 kubectl get pods -o wide
  133. 132 kubectl get nodes
  134. 133 kubectl describe node worker1
  135. 134 kubectl get pods
  136. 135 kubectl get nodes
  137. 136 cka/counter.sh 5
  138. 137 cd cka
  139. 138 ls
  140. 139 cd ..
  141. 140 git clone https://github.com/sandervanvugt/ckad
  142. 141 cd ckad
  143. 142 ls
  144. 143 vim pv.yaml
  145. 144 kubectl create -f pv.yaml
  146. 145 kubectl api-resources | less
  147. 146 vim pvc.yaml
  148. 147 kubectl create -f pvc.yaml
  149. 148 kubectl get pv
  150. 149 kubectl get storageclass
  151. 150 kubectl pv-pod.yaml
  152. 151 vim pv-pod.yaml
  153. 152 kubectl create -f pv-pod.yaml
  154. 153 kubectl exec -it pv-pod -- touch /usr/share/nginx/html/hello.txt
  155. 154 kubectl describe pv pv-volume
  156. 155 ls /
  157. 156 kubectl get pods -o wide
  158. 157 kubectl explain pv.spec | less
  159. 158 kubectl explain pv.spec.iscsi
  160. 159 kubectl explain pv.spec.initiatorName
  161. 160 kubectl explain pv.spec.iscsi
  162. 161 vim pvc.yaml
  163. 162 cat /etc/os-release
  164. 163 history
  165. 164 man signals
  166. 165 kubectl get nodes
  167. 166 kubectl label nodes worker2 disktype=ssd
  168. 167 cd ../cka
  169. 168 vim selector-pod.yaml
  170. 169 kubectl create -f selector-pod.yaml
  171. 170 kubectl get pods
  172. 171 kubectl describe pod nginx
  173. 172 kubectl delete po nginx
  174. 173 vim selector-pod.yaml
  175. 174 kubectl create -f selector-pod.yaml
  176. 175 kubectl get pods
  177. 176 kubectl tainint nodes worker1 example-key=value1:NoSchedule
  178. 177 kubectl taint nodes worker1 example-key=value1:NoSchedule
  179. 178 kubectl describe nodes worker1 | less
  180. 179 kubectl get pods -o wide
  181. 180 kubectl create deploy nginx-taint --image=nginx --replicas=3
  182. 181 kubectl get pods -o wide
  183. 182 vim taint-toleration.yaml
  184. 183 kubectl create -f taint-toleration.yaml
  185. 184 kubectl get pods -o wide
  186. 185 vim sc.txt
  187. 186 kubectl get nodes -o wide
  188. 187 kubectl describe nodes control
  189. 188 #kubectl taint node <nodename> node-role.kubernetes.io/master:NoSchedule-
  190. 189 kubectl edit control
  191. 190 kubectl edit node control
  192. 191 kubectl cordon --help
  193. 192 kubectl drain --help
  194. 193 kubectl drain worker2
  195. 194 kubectl get pods -o wide
  196. 195 kubectl drain worker2 --force --ignore-daemonsets
  197. 196 kubectl get pods -o wide
  198. 197 kubectl edit worker1
  199. 198 kubectl edit node worker1
  200. 199 kubectl get pods
  201. 200 kubectl describe pod testginx-6b7bbdbc9d-kt4db
  202. 201 kubectl get all
  203. 202 kubectl describe node worker1
  204. 203 kubectl describe node worker1 | grep taint
  205. 204 kubectl describe node worker1 | less
  206. 205 kubectl edit node worker1
  207. 206 kubectl get pods
  208. 207 kubectl describe ns default
  209. 208 kubectl get nodes
  210. 209 kubectl kubectl uncordon worker2
  211. 210 kubectl uncordon worker2
  212. 211 kubectl get pods
  213. 212 #ETCDCTL_API=3 etcdctl --endpoints 10.2.0.9:2379 \
  214. 213 #ETCDCTL_API=3 etcdctl --endpoints $ENDPOINT snapshot save snapshotdb
  215. 214 apt install etcd
  216. 215 sudo apt install etcd
  217. 216 etcdctl history
  218. 217 history
  219. 218 ps aux | grep 2379
  220. 219 ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key --cacert=/etc/kubernetes/pki/etcd/ca.crt snapshot save /tmp/etcdbackup
  221. 220 sudo ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key --cacert=/etc/kubernetes/pki/etcd/ca.crt snapshot save /tmp/etcdbackup
  222. 221 sudo ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key --cacert=/etc/kubernetes/pki/etcd/ca.crt snapshot save /tmp/etcdback
  223. 222 mkdir -p /var/exam
  224. 223 sudo mkdir -p /var/exam
  225. 224 sudo cp /tmp/etcdback /var/exam
  226. 225 #sudo ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key --cacert=/etc/kubernetes/pki/etcd/ca.crt snapshot save /tmp/etcdback
  227. 226 ps aux | grep server.crt
  228. 227 ETCDCTL_API=3 etcdctl --help
  229. 228 ./counter.sh 12
  230. 229 vim ~/.kube/config
  231. 230 sudo useradd -G sudo anna
  232. 231 id
  233. 232 sudo passwd anna
  234. 233 su - anna
  235. 234 sudo userdel -r anna
  236. 235 sudo useradd -m -G sudo anna
  237. 236 sudo passwd anna
  238. 237 su - anna
  239. 238 vim podaccessrole.yaml
  240. 239 kubectl create -f podaccessrole.yaml
  241. 240 vim rolebinding.yaml
  242. 241 kubectl create -f rolebinding.yaml
  243. 242 kubectl run rolepod --image-=nginx
  244. 243 kubectl run rolepod --image=nginx
  245. 244 kubectl get pods
  246. 245 su - anna
  247. 246 kubectl auth can-i get pods --as anna
  248. 247 kubectl auth can-i get pods --as bob
  249. 248 ./counter.sh 27
  250. 249 kubectl top
  251. 250 kubectl top pod
  252. 251 git clone https://github.com/kubernetes-sigs/metrics-server
  253. 252 cd metrics-server/
  254. 253 ls
  255. 254 cd manifests/
  256. 255 ls
  257. 256 kubectl create -f base/
  258. 257 cd base
  259. 258 cd ..
  260. 259 kubectl delete -f manifests/base/
  261. 260 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  262. 261 kubectl -n kube-system get pods
  263. 262 kubectl -n kube-system edit deploy metrics-server
  264. 263 kubectl -n kube-system get pods
  265. 264 kubectl get pods
  266. 265 kubectl get pods -n kube-system
  267. 266 kubectl top pod
  268. 267 cd
  269. 268 kubectl get all -n kube-system
  270. 269 kubectl delete -n kube-system daemonset weave-net
  271. 270 kubectl get all -n kube-system
  272. 271 kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
  273. 272 wget https://docs.projectcalico.org/manifests/custom-resources.yaml
  274. 273 vim custom-resources.yaml
  275. 274 kubectl create -f custom-resources.yaml
  276. 275 kubectl get pods -n calico-system
  277. 276 kubectl get all -n calico-system
  278. 277 kubectl logs -n calico-system calico-node-bx9l2
  279. 278 kubectl create deploy testing --image=nginx --relicas=3
  280. 279 kubectl create deploy testing --image=nginx --replicas=3
  281. 280 kubectl get all
  282. 281 kubectl get all -o wide
  283. 282 kubectl get all -n calico-system
  284. 283 cd cka
  285. 284 vim nwpolicy-complete-example.yaml
  286. 285 kubectl apply -f nwpolicy-complete-example.yaml
  287. 286 kubectl expose pod nginx --port=80
  288. 287 kubectl describe svc nginx
  289. 288 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  290. 289 kubectl label pod busybox access=true
  291. 290 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  292. 291 kubectl get all -n calico-system
  293. 292 kubectl get pods -o wide
  294. 293 kubectl get svc
  295. 294 kubectl get pods -n kube-system
  296. 295 sudo reboot
  297. 296 kubectl get all -n calico-system
  298. 297 kubectl get all
  299. 298 sudo poweroff
  300. 299 history
  301.  
  302.  
  303.  
Add Comment
Please, Sign In to add comment