Kubernetes Notes nov 2023
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
How to create a k8 cluster
https://www.devopsschool.com/blog/kubernetes-1-23-6-cluster-setup-master-and-worker-in-ubuntu-20-04/
API
C
cmd
yaml
R
cmd
yaml
U
cmd
yaml
D
cmd
yaml
==============================================
18 kubectl
19 clear
20 kubectl cluster-info
21 kubectl get nodes
22 clear
23 ls
24 kubectl get pods --all-namespaces
25 clear
26 ls
27 clear
28 kubectl
29* clear
30 kubectl api-resources
31 clear
32 kubectl
33 clear
34 kubectl version
35 kubectl get ns
36 kubectl create ns dev
37 kubectl create nsqa
38 kubectl create ns qa
39 kubectl get ns
40 kubectl edit ns dev
41 kubectl get ns
42 kubectl get ns --show-labels
43 kubect delete ns qa
44 kubectl delete ns qa
45 kubectl get ns --show-labels
k8 aws
POD ec2-instance
deploy asg
svc lb
Kubernetes Pod Example Programs
apiVersion: v1
kind: Pod
metadata:
name: rajesh
labels:
app: helloworld
spec:
containers:
- name: devopsschool1
image: scmgalaxy/nginx-devopsschoolv1
ports:
- name: nginx-port
containerPort: 80
45 kubectl get ns --show-labels
46 history
47 kubectl api-resources
48 kubectl get ns --show-labels
49 clear
50 ls
51 clear
52 ls
53 kubectl get pods
54 vi pod.yaml
55 kubectl create -f pod.yam
56 kubectl create -f pod.yaml
57 kubectl get pods
58 kubectl get pods -o wide
59 kubectl edit pod rajesh
60 kubectl get pods -o wide
61 kubectl get pods -o wide --show-labels
62 curl http://192.168.0.5
63 lear
64 clear
65 kubectl get pods
66 kubectl delete pod rajesh
67 kubectl get pods
68 kubectl create -f pod.yaml
69 kubectl get pods
70 kubectl get pods -o wide
71 curl http://192.168.0.6
72 kubectl logs rajesh
73 curl http://192.168.0.6
74 kubectl logs rajesh
75 kubectl exec -it rajesh /bin/bash
114 kubectl create deploy -h
115 clear
116 ls
117 kubectl get deploy
118 kubectl create deployment my-dep --image=scmgalaxy/nginx-devopsschoolv1 --replicas=10
119 kubectl get deploy
120 kubectl get pods
121 kubectl delete pod my-dep-7d597cfb66-cpd64 my-dep-7d597cfb66-g6qvd my-dep-7d597cfb66-jrkg8
122 kubectl get pods
123 clear
124 kubectl get svc
125 kubectl get deploy
126 kubectl expose -h
127 clear
128 kubectl expose deploy my-dep --port=8080 --target-port=80
129 kubectl expose deploy my-dep --port=8080 --target-port=80 --type=NodePort --name np
130 kubectl get svc
131 curl http://10.96.92.5:8080
132 kubectl descrive svc np
133 kubectl describe svc np