Chapter02(day-3)
25 January 2025 09:16
Deployment
Objectives:
1. What is the Project in the kubernetes
2. Deploy the container in the kubernetes
3. Imperative mode vs declarative
4. Reliability and scalability (label and selector & RC/RS, Deployment)
5. Rolling and rollback
6. Deployment strategy
Learning vs Real time
1. What is the Project in the kubernetes
1. resource isolation between teams/users
2. improve the administrator security
3. restrict un-authorized operation over the pod .
4. we can delegate role access to user (RBAC)
5. limit cpu/memory for the pod/containers.
Noted: project=Namespace
List/create/use/delete
2. Deploy the container in the kubernetes ?
orphan pod : no failover, no scalability , no reliability
1. Impetrative: command line
2. Declarative : manifests/yaml file ?
kubernetes Morning Page 1
Yaml syntax ?
1. String
2. Listing
3. Mapping
4. List mapping
how to create same using declarative mode
controlled pod
1. RC : replication controllers ?
1. scalability
2. reliability
156 kubectl config get-context
157 kubectl config get-contexts
158 clear
159 kubectl get ns
160 clear
161 kubectl create ns testing
162 kubectl run test --image=docker.io/nginx -n testing
163 kubectl get pod -n testing
164 kubectl get pod -n testing -o wide
165 kubectl get pod -n testing
166 kubectl logs test -n testing
167 kubectl exec -it test -n testing bash
168 kubectl exec -it test -n testing -- bash
169 kubectl exec -it test -n testing -- sh
170 kubectl get pod -n testing
171 kubectl describe pod test -n testing
172 kubectl get pod -n testing
173 kubectl delete pod test -n testing
174 kubectl get pod -n testing
175 kubectl get pod -n cdi
176 kubectl describe pod cdi-apiserver-55dd4458c6-lbghd -n cdi | grep -i controller
177 kubectl describe pod cdi-apiserver-55dd4458c6-lbghd -n cdi | grep -i controll
178 history
179 clear
kubernetes Morning Page 2
179 clear
180 cat > pod.yaml
181 vim pod.yaml
182 kubectl create -f pod.yaml -n testing
183 kubectl get pod -n testing
184 vim pod.yaml
185 kubectl create -f pod.yaml
186 vim pod.yaml
187 kubectl create -f pod.yaml
188 vim pod.yaml
189 kubectl create -f pod.yaml
190 vim pod.yaml
191 kubectl create -f pod.yaml
192 vim pod.yaml
193 kubectl create -f pod.yaml
194 vim pod.yaml
195 kubectl create -f pod.yaml
196 clear
197 kubectl api-resources
198 cat pod.yaml
199 vim pod.yaml
200 kubectl create -f pod.yaml -n testing
201 vim pod.yaml
202 kubectl explain pod --recursive=true
203 kubectl explain pod --recursive=true | grep -iA5 namespace
204 kubectl explain pod --recursive=true | grep -ib5 namespace
205 kubectl explain pod --recursive=true | grep -iB5 namespace
206 kubectl explain pod --recursive=true | less
207 vim pod.yaml
208 kubectl explain pod.spec
209 cat > rc.yml
210 mv rc.yml kr.yml
211 vim kr.yml
212 kubectl api-resources
213 vim kr.yml
214 kubectl create -f kr.yml -n testing
215 kubectl get pod -n testing
216 kubectl describe pod demo -n testing | grep -i controll
217 kubectl describe pod krnetwork-cbvdb -n testing | grep -i controll
218 kubectl get rc -n krnetwork
219 kubectl get rc -n testing
220 kubectl delete pod demo ran sham -n testing
221 kubectl get pod -n testing
222 kubectl get rc -n testing
223 kubectl delete pod krnetwork-cbvdb -n testing
224 kubectl get rc -n testing
225 kubectl get pod -n testing
226 kubectl scale --replicas=4 rc krnetwork -n testing
227 kubectl get rc -n testing
228 kubectl get pod -n testing
229 kubectl get pod -n testing -o wide
230 vim kr.yml
231 ls
232 vim kr.yml
233 kubectl get rc -n testing
234 kubectl apply -f kr.yml -n testing
235 kubectl get rc -n testing
236 rm -f kr.yml
kubernetes Morning Page 3
236 rm -f kr.yml
237 kubectl get rc -n testing
238 kubectl delete rc krnetwork -n testing
239 kubectl get rc -n testing
240 kubectl get pod -n testing
241 clear
242 git clone https://github.com/krnetworktraining1/kubernetes-manifests.git
243 cd kubernetes-manifests/
244 ls
245 kubectl create -f replication.yml -n testing
246 cd
247 kubectl get rc -n testing
248 kubectl edit rc krnetwork -n testing
249 kubectl get pod -n testing
250 kubectl scale --replicas=4 rc krnetwork -n testing
251 vim kubernetes-manifests/replication.yml
252 kubectl apply -f kubernetes-manifests/replication.yml
253 kubectl edit rc krnetwork -n testing
254 vim kubernetes-manifests/replication.yml
255 kubectl api-resources
256 vim kubernetes-manifests/replication.yml
257 kubectl explain replicationcontroller.spec.template.spec
258 cat pod.yaml
259 vim pod.yaml
260 kubectl create -f pod.yaml
261 vim pod
262 vim pod.yaml
263 kubectl create -f pod.yaml
264 vim pod.yaml
265 kubectl create -f pod.yaml
266 vim pod.yaml
267 kubectl create -f pod.yaml
268 vim pod.yaml
269 kubectl explain pod
270 kubectl explain pod.metadata
271 kubectl explain pod.spec
272 kubectl explain pod.spec.containers
273 clear
274 kubectl get nodes
275 history
kubernetes Morning Page 4