sandervanvugt

CKA day1 july21

Jul 13th, 2021
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.09 KB | None | 0 0
  1. [student@control .kube]$ history
  2. 1 mkdir .kube
  3. 2 sudo cp -i /etc/kubernetes/admin.conf .kube/config
  4. 3 sudo chown student:student .kube/config
  5. 4 kubectl get all
  6. 5 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
  7. 6 kubectl get pods -n kube-system
  8. 7 exit
  9. 8 kubectl get nodes
  10. 9 ssh 192.168.29.125
  11. 10 kubectl get nodes
  12. 11 exit
  13. 12 kubectl create -h | less
  14. 13 kubectl create ns -h | less
  15. 14 kubectl create ns mynamespace
  16. 15 kubectl run -n mynamespace alpine --image=alpine --restart=Never -- /bin/sh -c 'sleep 3600'
  17. 16 kubectl get pods
  18. 17 kubectl get pods -n mynamespace
  19. 18 kubectl get pods -o yaml -n mynamespace | less
  20. 19 kubectl delete pods alpine -n mynamespace
  21. 20 kubectl run -n mynamespace alpine --image=alpine --restart=Always -- /bin/sh -c 'sleep 3600'
  22. 21 kubectl get pods -n mynamespace
  23. 22 kubectl edit pod alpine -n mynamespace
  24. 23 kubectl completion -h | less
  25. 24 source <(kubectl completion bash)
  26. 25 git clone https://github.com/sandervanvugt/cka
  27. 26 cka/counter.sh 15
  28. 27 kubectl run busybox --image=busybox
  29. 28 kubectl get pods
  30. 29 kubectl describe pod busybox
  31. 30 vim jc.yaml
  32. 31 kubectl run -h |
  33. 32 kubectl run -h |less
  34. 33 kubectl run busyfox --image=busybox --dry-run=client -o yaml --command -- sleep 3600
  35. 34 kubectl create ns restricted
  36. 35 kubectl create -h | less
  37. 36 kubectl create quota -h | less
  38. 37 kubectl create quota restricted --hard pods=3,memory=1Gi -n restricted
  39. 38 kubectl describe quota restricted
  40. 39 kubectl describe quota restricted -n restricted
  41. 40 kubectl describe ns restricted
  42. 41 kubectl create deployment newginx --image=nginx --replicas=3
  43. 42 kubectl get all -n restricted
  44. 43 kubectl delete deployments.apps newginx
  45. 44 kubectl create deployment newginx --image=nginx --replicas=3 -n restricted
  46. 45 kubectl get all -n restricted
  47. 46 kubectl describe replicasets.apps newginx-645dff97c6 -n restricted
  48. 47 kubectl get all -n restricted
  49. 48 kubectl set -h | less
  50. 49 kubectl set resources -h | less
  51. 50 #kubectl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
  52. 51 kubectl set resources -n restricted deploy newginx --limits=memory=512Mi --requests=memory=256Mi
  53. 52 kubectl get all -n restricted
  54. 53 kubectl describe -n restricted
  55. 54 kubectl describe ns -n restricted
  56. 55 kubectl scale deploy newginx -n restricted --replicas=4
  57. 56 kubectl get all -n restricted
  58. 57 kubectl -n restricted describe rs newginx-584559b6d
  59. 58 history
  60. 59 kubectl set resources -h | less
  61. 60 cka/counter.sh 20
  62. 61 cd cka/
  63. 62 vim nwpolicy-complete-example.yaml
  64. 63 kubectl explain networkpolicy.spec
  65. 64 kubectl explain --recursive networkpolicy.spec
  66. 65 vim nwpolicy-complete-example.yaml
  67. 66 kubectl create -f nwpolicy-complete-example.yaml
  68. 67 kubectl delete -f nwpolicy-complete-example.yaml
  69. 68 kubectl create -f nwpolicy-complete-example.yaml
  70. 69 kubectl get svc
  71. 70 kubectl expose pod nginx --port=80
  72. 71 kubectl get svc
  73. 72 kubectl get endpoints
  74. 73 kubectl get pods -o wide
  75. 74 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  76. 75 kubectl get pods --show-labels
  77. 76 kubectl describe nwp
  78. 77 kubectl describe networkpolicy
  79. 78 kubectl label pod busybox access=true
  80. 79 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  81. 80 ./counter.sh 8
  82. 81 kubectl get nodes
  83. 82 kubectl taint -h | less
  84. 83 #kubectl taint nodes worker2.example.com key1=value1:NoExecute
  85. 84 kubectl get pods -o wide
  86. 85 kubectl taint nodes worker2.example.com key1=value1:NoExecute
  87. 86 kubectl get pods -o wide
  88. 87 kubectl create deploy -h | less
  89. 88 kubectl explain deploy.spec | less
  90. 89 kubectl explain --recursive deploy.spec | less
  91. 90 kubectl create deploy -h | less
  92. 91 kubectl create deploy idontcare --image=nginx --replicas=3 --dry-run=client -o yaml > idont.yaml
  93. 92 vim idont.yaml
  94. 93 kubectl create -f idont.yaml
  95. 94 kubectl get pods -o wide
  96. 95 kubectl taint nodes worker2.example.com key1=value1:NoExecute-
  97. 96 kubectl get pods -o wide -A
  98. 97 ./counter.sh 15
  99. 98 ssh root@worker2
  100. 99 kubectl get pods
  101. 100 ssh root@worker2
  102. 101 kubectl describe nodes control.example.com
  103. 102 kubectl describe nodes control.example.com | less
  104. 103 kubectl taint node control.example.com node-role.kubernetes.io/master:NoSchedule-
  105. 104 kubectl taint node control.example.com node-role.kubernetes.io/master:NoSchedule
  106. 105 kubectl set resources -h
  107. 106 kubectl create deployment -h | less
  108. 107 cd
  109. 108 cd .kube/
  110. 109 rm config
  111. 110 exit
  112. 111 kubectl get all
  113. 112 kubectl config -h
  114. 113 kubectl config view
  115. 114 cd .kube/
  116. 115 ls
  117. 116 sudo cp /etc/kubernetes/admin.conf config
  118. 117 ls -l
  119. 118 sudo chown student:student config
  120. 119 cd
  121. 120 kubectl get all
  122. 121 kubectl config view
  123. 122 cd .kube/
  124. 123 vim config
  125. 124 history
  126.  
  127. ROOT SHELL[root@control ~]# history
  128. 1 yum install -y vim git bash-completion
  129. 2 git clone https://github.com/sandervanvugt/cka
  130. 3 cd cka
  131. 4 ls
  132. 5 vim setup-container.sh
  133. 6 ./setup-container.sh
  134. 7 ./setup-docker.sh
  135. 8 ls
  136. 9 ./setup-kubetools.sh
  137. 10 history
  138. 11 kubeadm init
  139. 12 cd
  140. 13 vim clustersetup.txt
  141. 14 history
  142. 15 cka/counter.sh 12
  143. 16 ls
  144. 17 cat clustersetup.txt
  145. 18 su - student
  146. 19 cat clustersetup.txt
  147. 20 ssh 192.168.29.124
  148. 21 kubectl get nodes
  149. 22 exit
  150. 23 su - student
  151. 24 kubeadm token create -h | less
  152. 25 kubeadm token create --print-join-token
  153. 26 kubeadm token create -h | less
  154. 27 kubeadm token create --print-join-command
  155. 28 cd cka/
  156. 29 ls
  157. 30 vim setup-container.sh
  158. 31 vim setup-kub
  159. 32 vim setup-kubetools.sh
  160. 33 su - student
  161. 34 cd ..
  162. 35 ls
  163. 36 less clustersetup.txt
  164. 37 history
Add Comment
Please, Sign In to add comment