sandervanvugt

kube3weeks april22 day1

Apr 8th, 2022
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1. ### CONTROL
  2. student@control:~/cka$ history
  3. 1 sudo vim /etc/hosts
  4. 2 cat /etc/hosts
  5. 3 cat /etc/os-release
  6. 4 free -m
  7. 5 lscpu
  8. 6 lsblk
  9. 7 sudo nano /etc/fstab
  10. 8 sudo swapoff -a
  11. 9 free
  12. 10 git clone https://github.com/sandervanvugt/cka
  13. 11 cd cka
  14. 12 history
  15. 13 ls
  16. 14 vim setup-container.sh
  17. 15 ./setup-container.sh
  18. 16 ls
  19. 17 ./setup-kubetools.sh
  20. 18 vim setup-kubetools
  21. 19 vim setup-kubetools.sh
  22. 20 sudo setup-kubetools.sh
  23. 21 sudo ./setup-kubetools.sh
  24. 22 history
  25. 23 sudo -i
  26. 24 mkdir -p $HOME/.kube
  27. 25 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  28. 26 sudo chown $(id -u):$(id -g) $HOME/.kube/config
  29. 27 kubectl get all
  30. 28 kubectl apply -f https://docs.calico.org/manifests/calico.yaml
  31. 29 kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
  32. 30 kubectl get nodes
  33. 31 history
  34. 32 ./counter.sh 15
  35. 33 kubectl get all
  36. 34 source <(kubectl completion bash)
  37. 35 kubectl completion -h | less
  38. 36 kubectl create deployment myfirstapp --image=nginx --replicas=3
  39. 37 kubectl get all
  40. 38 history
  41. 39 kubectl get all
  42. 40 kubectl delete pod myfirstapp-ff65c646c-xshns
  43. 41 kubectl get all
  44. 42 kubectl run lonelypod --image=nginx
  45. 43 kubectl get all
  46. 44 kubectl delete pod lonelypod
  47. 45 kubectl get all
  48. 46 history
  49. 47 less ~/.kube/config
  50. 48 ip a
  51. 49 history
  52.  
  53. ###WORKER1
  54.  
  55. tudent@worker1:~/cka$ history
  56. 1 sudo vim /etc/hosts
  57. 2 sudo nano /etc/fstab
  58. 3 sudo swapoff -a
  59. 4 git clone https://github.com/sandervanvugt/cka
  60. 5 cd cka
  61. 6 ./setup-container.sh
  62. 7 sudo ./setup-kubetools.sh
  63. 8 history
  64. student@worker1:~/cka$ sudo -i
  65. root@worker1:~# kubeadm join 192.168.29.153:6443 --token r0zybl.zjdawcrzbw2s4z2l \
  66. > --discovery-token-ca-cert-hash sha256:2c26d79254c1a23bfcd6bf1bfd142b8127980e8f13a15b4d83f39fcb48126674
  67. [preflight] Running pre-flight checks
  68. [preflight] Reading configuration from the cluster...
  69. [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
  70. W0408 14:01:46.806272 14063 utils.go:69] The recommended value for "resolvConf" in "KubeletConfiguration" is: /run/systemd/resolve/resolv.conf; the provided value is: /run/systemd/resolve/resolv.conf
  71. [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
  72. [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
  73. [kubelet-start] Starting the kubelet
  74. [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
  75.  
  76. This node has joined the cluster:
  77. * Certificate signing request was sent to apiserver and a response was received.
  78. * The Kubelet was informed of the new secure connection details.
  79.  
  80. Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
  81.  
  82. root@worker1:~# history
  83. 1 kubeadm join 192.168.29.153:6443 --token r0zybl.zjdawcrzbw2s4z2l --discovery-token-ca-cert-hash sha256:2c26d79254c1a23bfcd6bf1bfd142b8127980e8f13a15b4d83f39fcb48126674
  84. 2 history
  85. root@worker1:~#
  86.  
  87. ### WORKSTATION
  88.  
  89. 1 cd cka
  90. 2 git clone https://github.com/sandervanvugt/cka
  91. 3 sudo apt install git
  92. 4 cd cka
  93. 5 git clone https://github.com/sandervanvugt/cka
  94. 6 cka/counter.sh 15
  95. 16 kubectl get all
  96. 19 sudo poweroff
  97. 22 git clone https://github.com/sandervanvugt/cka
  98. 23 cd cka
  99. 24 ls
  100. 25 sudo ./setup-kubetools.sh
  101. 26 kubectl get all
  102. 27 cd
  103. 28 mkdir .kube
  104. 29 scp 192.168.29.153:~.kube/config .kube
  105. 30 scp 192.168.29.153:~/.kube/config .kube
  106. 31 ls -l .kube/
  107. 32 kubectl get all
  108. 33 history
  109. 34 kubectl api-resources | less
  110. 35 kubectl explain pods.spec | less
  111. 36 kubectl explain deployment.spec | less
  112. 37 kubectl api-resources
  113. 38 kubectl explain ippools.spec
  114. 39 history
  115. 40 kubectl get pods
  116. 41 source <(kubectl completion bash)
  117. 42 kubectl get pods myfirstapp-ff65c646c-2pmkn -o yaml | less
  118. 43 kubectl run mynginx --image=nginx --dry-run=client -o yaml > mynginx.yaml
  119. 44 vim mynginx.yaml
  120. 45 sudo apt install vim
  121. 46 vim mynginx.yaml
  122. 47 kubectl explain pods.spec | less
  123. 48 vim mynginx.yaml
  124. 49 kubectl create -f mynginx.yaml
  125. 50 kubectl get pods
  126. 51 kubectl exec -it mynginx bash
  127. 52 kubectl exec -it mynginx -- sh
  128. 53 kubectl get pods
  129. 54 kubectl delete pod mynginx
  130. 55 kubectl exec -it myfirstapp-ff65c646c-2pmkn -- sh
  131. 56 kubectl get pods
  132. 57 kubectl get pods -A
  133. 58 git clone https://github.com/sandervanvugt/kube3weeks
  134. 59 cd kube3weeks/
  135. 60 vim multicontainer.yaml
  136. 61 kubectl create -f multicontainer.yaml
  137. 62 kubectl get pods
  138. 63 vim initcontainer.yaml
  139. 64 kubectl create -f initcontainer.yaml
  140. 65 kubectl get pods
  141. 66 kubectl create ns secret
  142. 67 kubectl run secret --image=nginx -n secret
  143. 68 kubectl get pods
  144. 69 kubectl get pods -n secret
  145. 70 kubectl get pods -n kube-system
  146. 71 history
  147.  
  148.  
  149.  
Advertisement
Add Comment
Please, Sign In to add comment