Advertisement
sandervanvugt

CKA marc23 day1

Mar 29th, 2023
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. student@control:~/cka$ history
  2. 1 ip a
  3. 2 git clone https://github.com/sandervanvugt/cka
  4. 3 cd cka
  5. 4 ls *sh
  6. 5 less setup-container.sh
  7. 6 ./setup-container.sh
  8. 7 ls
  9. 8 ls *sh
  10. 9 vim setup-kubetools-specific-version.sh
  11. 10 sudo ./setup-kubetools-specific-version.sh
  12. 11 sudo kubeadm --help
  13. 12 sudo kubeadm init
  14. 13 mkdir -p $HOME/.kube
  15. 14 kubectl get all
  16. 15 kubectl get pods -n kube-system
  17. 16 ls
  18. 17 kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/calico.yaml
  19. 18 kubectl get pods -n kube-system
  20. 19 kubectl get nodes
  21. 20 kubectl create deploy testapp --image=nginx --replicas=3
  22. 21 kubectl get all
  23. 22 history
  24. 23 echo AFTER COMMAND 13: run : sudo cp /etc/kubernetes/admin.conf ~/.kube/config; sudo chown $USER:$USER ~/.kube/config
  25. 24 vim wz.yaml
  26. 25 kubectl create ns mynamespace
  27. 26 kubectl run task2pod --image=alpine -n mynamespace -- sleep 3600
  28. 27 source <(kubectl completion bash)
  29. 28 kubectl get pods -n mynamespace
  30. 29 kubectl get pods -n mynamespace -o yaml | less
  31. 30 history
  32. 31 vim rp.yaml
  33. 32 kubectl apply -f rp.yaml
  34. 33 kubectl get pods
  35. 34 kubectl describe pod task3pod
  36. 35 vim wzz.yaml
  37. 36 kubectl delete pod task3pod
  38. 37 kubectl apply -f wzz.yaml
  39. 38 kubectl get pods
  40. 39 kubectl explain pod.spec.containers.spec.args
  41. 40 kubectl apply -f wzz.yaml
  42. 41 vim wzz.yaml
  43. 42 kubectl explain pod.spec.containers.args
  44. 43 cat wzz.yaml
  45. 44 kubectl get quota
  46. 45 kubectl create ns limited
  47. 46 kubectl create quota qtest --hard pods=3,cpu=100m,memory=500Mi -n limited
  48. 47 kubectl create quota -n limited
  49. 48 kubectl describe quota -n limited
  50. 49 kubectl create deployt nginx --image=nginx --replicas=3 -n limited
  51. 50 kubectl create deploy nginx --image=nginx --replicas=3 -n limited
  52. 51 kubectl get all -n limited
  53. 52 kubectl describe replicaset.apps/nginx-76d6c9b8c
  54. 53 kubectl describe replicaset.apps/nginx-76d6c9b8c -n limited
  55. 54 kubectl set resources -n limited deploy nginx --request cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi -n limited
  56. 55 kubectl set resources -n limited deploy nginx --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi -n limited
  57. 56 kubectl get all -n limited
  58. 57 kubectl describe quota -n limited
  59. 58 kubectl edit quota -n limited
  60. 59 kubectl get all -n limited
  61. 60 kubectl describe quota -n limited
  62. 61 kubectl get all -n limited
  63. 62 kubectl scale deploy -n limited nginx --replicas=3
  64. 63 kubectl scale deploy -n limited nginx --replicas=2
  65. 64 kubectl scale deploy -n limited nginx --replicas=3
  66. 65 kubectl get all -n limited
  67. 66 history
  68. 67 vim ts.yaml
  69. 68 cat ts.yaml
  70. 69 kubectl create ns restricted
  71. 70 kubectl create quota qrestricted --hard pods=3,memory=1000Mi -n restricted
  72. 71 kubectl describe quota qrestricted -n restricted
  73. 72 kubectl reate deploy task7deploy --image=nginx --replicas=3 -n restricted
  74. 73 kubectl create deploy task7deploy --image=nginx --replicas=3 -n restricted
  75. 74 kubectl get all -n restricted
  76. 75 kubectl set resources -n restricted deploy task7deploy
  77. 76 kubectl set resources -n restricted deploy task7deploy --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi
  78. 77 kubectl get all -n restricted
  79. 78 history
  80. 79 kubectl get deploy -n restricted
  81. 80 kubectl get deploy -n restricted -o yaml
  82. 81 kubectl get nodes
  83. 82 kubectl label nodes worker2 disktype=ssd
  84. 83 vim selector-pod.yaml
  85. 84 kubectl label nodes worker2 disktype-
  86. 85 kubectl apply -f selector-pod.yaml
  87. 86 kubectl get pods
  88. 87 kubectl describe pod nginx
  89. 88 kubectl label nodes worker2 disktype=ssd
  90. 89 kubectl get pods
  91. 90 kubectl get nodes --show-labels
  92. 91 kubectl edit node control
  93. 92 kubectl get pods -n kube-system -o wide
  94. 93 kubectl get ds -n kube-system calico-node -o yaml | less
  95. 94 kubectl create deploy ttest --image=nginx --replicas=20
  96. 95 kubectl get pods -o wide
  97. 96 kubectl delete deployments.apps ttest
  98. 97 kubectl taint nodes worker1 example-key=value1:NoSchedule
  99. 98 kubectl describe node worker1
  100. 99 kubectl create deploy nginx-taint --image=nginx
  101. 100 kubectl scale deployment nginx-taint --replicas 3
  102. 101 kubectl get pods -o wide
  103. 102 vim taint-toleration.yaml
  104. 103 kubectl apply -f taint-toleration.yaml
  105. 104 kubectl get pods -o wide
  106. 105 kubectl apply -f taint-toleration.yaml
  107. 106 vim taint-toleration.yaml
  108. 107 kubectl delete -f taint-toleration
  109. 108 kubectl delete -f taint-toleration.yaml
  110. 109 kubectl apply -f taint-toleration.yaml
  111. 110 kubectl get pods -o wide
  112. 111 kubectl edit node worker1
  113. 112 history
  114. 113 vim tg.yaml
  115. 114 ./counter.sh 5
  116. 115 vim tss.yaml
  117. 116 kubectl apply -f tss.yaml
  118. 117 vim tss.yaml
  119. 118 kubectl apply -f tss.yaml
  120. 119 kubectl get pods
  121. 120 kubectl describe pod task4pod
  122. 121 vim tss.yaml
  123. 122 kubectl delete -f tss.yaml
  124. 123 kubectl apply -f tss.yaml
  125. 124 kubectl get pods
  126. 125 vim tss.yaml
  127. 126 touch --help
  128. 127 kubectl delete -f tss.yaml
  129. 128 vim tss.yaml
  130. 129 kubectl apply -f tss.yaml
  131. 130 kubectl get pods
  132. 131 vim tss.yaml
  133. 132 vim resize_pvc.yaml
  134. 133 kubectl apply -f resize_pvc.yaml
  135. 134 kubectl edit pvc -n myvol
  136. 135 kubectl explain --recursive persistentvolumeclaim
  137. 136 kubectl explain --recursive persistentvolumeclaim | less
  138. 137 kubectl explain --recursive storageclass | less
  139. 138 kubectl edit pvc -n myvol
  140. 139 ./counter.sh 11
  141. 140 kubectl get pods -n kube-system
  142. 141 kubectl get pods -n kube-system calico-node-zpb6d -o yaml
  143. 142 kubectl get pods -n roles --as=system:serviceaccount:roles:calico-node
  144. 143 kubectl get clusterroles
  145. 144 kubectl get clusterroles | grep calico
  146. 145 kubectl get clusterroles calico-node -o yaml
  147. 146 kubectl get clusterroles calico-node -o yaml | less
  148. 147 kubectl get clusterrolebindings
  149. 148 kubectl get clusterrolebindings | grep calico
  150. 149 kubectl describe clusterrolebindings.rbac.authorization.k8s.io calico-node
  151. 150 kubectl create sa --help | less
  152. 151 kubectl create sa sander
  153. 152 kubectl create role -h | less
  154. 153 kubectl create role sanderrole --verb=get --verb=list --verb=watch --resource=pods
  155. 154 kubectl describe role sanderrole
  156. 155 kubectl create rolebinding -h | less
  157. 156 kubectl create rolebinding sanderrolebinding --role=sanderrole --serviceaccount=default:sander
  158. 157 kubectl describe rolebindings.rbac.authorization.k8s.io sanderrolebinding
  159. 158 history
  160. 159 vim wzzz.yaml
  161. 160 ./counter.sh 0
  162. 161 history
  163.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement