2nd lesson added
This commit is contained in:
parent
d5ef4add57
commit
20706aa84b
64
kubernetes/2/1.txt
Normal file
64
kubernetes/2/1.txt
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl apply -f 1.yaml
|
||||||
|
pod/nginx-guaranteed created
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl get pod nginx-guaranteed -o wide
|
||||||
|
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
|
||||||
|
nginx-guaranteed 1/1 Running 0 2m4s 10.244.5.177 k8s-worker2 <none> <none>
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl describe pod nginx-guaranteed
|
||||||
|
Name: nginx-guaranteed
|
||||||
|
Namespace: default
|
||||||
|
Priority: 0
|
||||||
|
Service Account: default
|
||||||
|
Node: k8s-worker2/192.168.88.229
|
||||||
|
Start Time: Fri, 17 Oct 2025 13:04:17 +0300
|
||||||
|
Labels: app=nginx
|
||||||
|
Annotations: <none>
|
||||||
|
Status: Running
|
||||||
|
IP: 10.244.5.177
|
||||||
|
IPs:
|
||||||
|
IP: 10.244.5.177
|
||||||
|
Containers:
|
||||||
|
nginx:
|
||||||
|
Container ID: cri-o://91d47234f22e127819396fe15654f9adafbc61fcd9fbb566f75427b6bd3d0c6e
|
||||||
|
Image: nginx:latest
|
||||||
|
Image ID: docker.io/library/nginx@sha256:35fabd32a7582bed5da0a40f41fd4984df7ddff32f81cd6be4614d07240ec115
|
||||||
|
Port: <none>
|
||||||
|
Host Port: <none>
|
||||||
|
State: Running
|
||||||
|
Started: Fri, 17 Oct 2025 13:04:23 +0300
|
||||||
|
Ready: True
|
||||||
|
Restart Count: 0
|
||||||
|
Limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 500Mi
|
||||||
|
Requests:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 500Mi
|
||||||
|
Environment: <none>
|
||||||
|
Mounts:
|
||||||
|
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-fshmj (ro)
|
||||||
|
Conditions:
|
||||||
|
Type Status
|
||||||
|
PodReadyToStartContainers True
|
||||||
|
Initialized True
|
||||||
|
Ready True
|
||||||
|
ContainersReady True
|
||||||
|
PodScheduled True
|
||||||
|
Volumes:
|
||||||
|
kube-api-access-fshmj:
|
||||||
|
Type: Projected (a volume that contains injected data from multiple sources)
|
||||||
|
TokenExpirationSeconds: 3607
|
||||||
|
ConfigMapName: kube-root-ca.crt
|
||||||
|
Optional: false
|
||||||
|
DownwardAPI: true
|
||||||
|
QoS Class: Guaranteed
|
||||||
|
Node-Selectors: <none>
|
||||||
|
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
|
||||||
|
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
|
||||||
|
Events:
|
||||||
|
Type Reason Age From Message
|
||||||
|
---- ------ ---- ---- -------
|
||||||
|
Normal Scheduled 2m32s default-scheduler Successfully assigned default/nginx-guaranteed to k8s-worker2
|
||||||
|
Normal Pulling 2m31s kubelet Pulling image "nginx:latest"
|
||||||
|
Normal Pulled 2m27s kubelet Successfully pulled image "nginx:latest" in 4.263s (4.263s including waiting). Image size: 163615579 bytes.
|
||||||
|
Normal Created 2m26s kubelet Created container: nginx
|
||||||
|
Normal Started 2m26s kubelet Started container nginx
|
||||||
17
kubernetes/2/1.yaml
Normal file
17
kubernetes/2/1.yaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: nginx-guaranteed
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx
|
||||||
|
image: nginx:latest
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "500Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
limits:
|
||||||
|
memory: "500Mi"
|
||||||
|
cpu: "500m"
|
||||||
7
kubernetes/2/2.txt
Normal file
7
kubernetes/2/2.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl apply -f 2.yaml
|
||||||
|
pod/nginx-busybox-burstable created
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl get pod nginx-busybox-burstable -o wide
|
||||||
|
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
|
||||||
|
nginx-busybox-burstable 2/2 Running 0 26s 10.244.7.183 k8s-worker0 <none> <none>
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl describe pod nginx-busybox-burstable | grep "QoS Class"
|
||||||
|
QoS Class: Burstable
|
||||||
27
kubernetes/2/2.yaml
Normal file
27
kubernetes/2/2.yaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: nginx-busybox-burstable
|
||||||
|
labels:
|
||||||
|
app: demo-burstable
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx
|
||||||
|
image: nginx:stable
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "300Mi"
|
||||||
|
cpu: "200m"
|
||||||
|
limits:
|
||||||
|
memory: "600Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
- name: busybox
|
||||||
|
image: busybox
|
||||||
|
command: ["sh", "-c", "sleep 3600"]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "100Mi"
|
||||||
|
cpu: "50m"
|
||||||
|
limits:
|
||||||
|
memory: "200Mi"
|
||||||
|
cpu: "150m"
|
||||||
7
kubernetes/2/3.txt
Normal file
7
kubernetes/2/3.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl apply -f 3.yaml
|
||||||
|
pod/be-busybox created
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl get pod be-busybox -o wide
|
||||||
|
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
|
||||||
|
be-busybox 1/1 Running 0 29s 10.244.6.212 k8s-worker1 <none> <none>
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl describe pod be-busybox | grep "QoS Class"
|
||||||
|
QoS Class: BestEffort
|
||||||
11
kubernetes/2/3.yaml
Normal file
11
kubernetes/2/3.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: be-busybox
|
||||||
|
labels:
|
||||||
|
app: best-effort
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: busybox
|
||||||
|
image: busybox:latest
|
||||||
|
command: ["sleep", "3600"]
|
||||||
21
kubernetes/2/4-pod0.yaml
Normal file
21
kubernetes/2/4-pod0.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: stress0
|
||||||
|
labels:
|
||||||
|
app: res-test
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: stress
|
||||||
|
image: alpine:latest
|
||||||
|
command: ["/bin/sh", "-c"]
|
||||||
|
args:
|
||||||
|
- apk add --no-cache stress-ng &&
|
||||||
|
stress-ng --cpu 1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "300m"
|
||||||
|
memory: "300Mi"
|
||||||
|
limits:
|
||||||
|
cpu: "500m"
|
||||||
|
memory: "500Mi"
|
||||||
21
kubernetes/2/4-pod1.yaml
Normal file
21
kubernetes/2/4-pod1.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: stress1
|
||||||
|
labels:
|
||||||
|
app: res-test
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: stress
|
||||||
|
image: alpine:latest
|
||||||
|
command: ["/bin/sh", "-c"]
|
||||||
|
args:
|
||||||
|
- apk add --no-cache stress-ng &&
|
||||||
|
stress-ng --cpu 1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "100m"
|
||||||
|
memory: "100Mi"
|
||||||
|
limits:
|
||||||
|
cpu: "200m"
|
||||||
|
memory: "200Mi"
|
||||||
17
kubernetes/2/4.txt
Normal file
17
kubernetes/2/4.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl apply -f 4-pod1.yaml
|
||||||
|
pod/stress1 created
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl apply -f 4-pod0.yaml
|
||||||
|
pod/stress0 created
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl get pods
|
||||||
|
NAME READY STATUS RESTARTS AGE
|
||||||
|
be-busybox 1/1 Running 0 36m
|
||||||
|
nginx-busybox-burstable 2/2 Running 30 (34m ago) 30h
|
||||||
|
nginx-guaranteed 1/1 Running 0 30h
|
||||||
|
stress0 1/1 Running 0 6s
|
||||||
|
stress1 1/1 Running 0 9s
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl top pod stress1
|
||||||
|
NAME CPU(cores) MEMORY(bytes)
|
||||||
|
stress1 190m 24Mi
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl top pod stress0
|
||||||
|
NAME CPU(cores) MEMORY(bytes)
|
||||||
|
stress0 501m 24Mi
|
||||||
77
kubernetes/2/5.txt
Normal file
77
kubernetes/2/5.txt
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl describe pod oom
|
||||||
|
Name: oom
|
||||||
|
Namespace: default
|
||||||
|
Priority: 0
|
||||||
|
Service Account: default
|
||||||
|
Node: k8s-worker1/192.168.88.230
|
||||||
|
Start Time: Sun, 19 Oct 2025 21:37:46 +0300
|
||||||
|
Labels: app=stress-ng-oom
|
||||||
|
Annotations: <none>
|
||||||
|
Status: Running
|
||||||
|
IP: 10.244.6.219
|
||||||
|
IPs:
|
||||||
|
IP: 10.244.6.219
|
||||||
|
Containers:
|
||||||
|
oom:
|
||||||
|
Container ID: cri-o://679b9544bf5c02ddb07f9e38693ba89e746444391dc1c0603ee29688716eba62
|
||||||
|
Image: alpine:latest
|
||||||
|
Image ID: docker.io/library/alpine@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412
|
||||||
|
Port: <none>
|
||||||
|
Host Port: <none>
|
||||||
|
Command:
|
||||||
|
/bin/sh
|
||||||
|
-c
|
||||||
|
Args:
|
||||||
|
apk add --no-cache stress-ng && stress-ng -m 1 --vm-bytes 256M
|
||||||
|
State: Terminated
|
||||||
|
Reason: OOMKilled
|
||||||
|
Exit Code: 137
|
||||||
|
Started: Sun, 19 Oct 2025 21:37:50 +0300
|
||||||
|
Finished: Sun, 19 Oct 2025 21:37:52 +0300
|
||||||
|
Ready: False
|
||||||
|
Restart Count: 0
|
||||||
|
Limits:
|
||||||
|
memory: 200Mi
|
||||||
|
Requests:
|
||||||
|
memory: 100Mi
|
||||||
|
Environment: <none>
|
||||||
|
Mounts:
|
||||||
|
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-xkd2w (ro)
|
||||||
|
Conditions:
|
||||||
|
Type Status
|
||||||
|
PodReadyToStartContainers True
|
||||||
|
Initialized True
|
||||||
|
Ready False
|
||||||
|
ContainersReady False
|
||||||
|
PodScheduled True
|
||||||
|
Volumes:
|
||||||
|
kube-api-access-xkd2w:
|
||||||
|
Type: Projected (a volume that contains injected data from multiple sources)
|
||||||
|
TokenExpirationSeconds: 3607
|
||||||
|
ConfigMapName: kube-root-ca.crt
|
||||||
|
Optional: false
|
||||||
|
DownwardAPI: true
|
||||||
|
QoS Class: Burstable
|
||||||
|
Node-Selectors: <none>
|
||||||
|
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
|
||||||
|
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
|
||||||
|
Events:
|
||||||
|
Type Reason Age From Message
|
||||||
|
---- ------ ---- ---- -------
|
||||||
|
Normal Scheduled 9s default-scheduler Successfully assigned default/oom to k8s-worker1
|
||||||
|
Normal Pulled 5s kubelet Successfully pulled image "alpine:latest" in 2.684s (2.684s including waiting). Image size: 8619075 bytes.
|
||||||
|
Normal Created 5s kubelet Created container: oom
|
||||||
|
Normal Started 5s kubelet Started container oom
|
||||||
|
Normal Pulling 3s (x2 over 8s) kubelet Pulling image "alpine:latest"
|
||||||
|
grape@lonetrek:~/Documents/devops/devops/kubernetes/2$ kubectl logs oom
|
||||||
|
fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/APKINDEX.tar.gz
|
||||||
|
fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/community/x86_64/APKINDEX.tar.gz
|
||||||
|
(1/5) Installing judy (1.0.5-r1)
|
||||||
|
(2/5) Installing libmd (1.1.0-r0)
|
||||||
|
(3/5) Installing libbsd (0.12.2-r0)
|
||||||
|
(4/5) Installing liblksctp (1.0.19-r5)
|
||||||
|
(5/5) Installing stress-ng (0.18.08-r0)
|
||||||
|
Executing busybox-1.37.0-r19.trigger
|
||||||
|
OK: 13 MiB in 21 packages
|
||||||
|
stress-ng: info: [1] defaulting to a 1 day run per stressor
|
||||||
|
stress-ng: info: [1] dispatching hogs: 1 vm
|
||||||
19
kubernetes/2/5.yaml
Normal file
19
kubernetes/2/5.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: oom
|
||||||
|
labels:
|
||||||
|
app: stress-ng-oom
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: oom
|
||||||
|
image: alpine:latest
|
||||||
|
command: ["/bin/sh", "-c"]
|
||||||
|
args:
|
||||||
|
- apk add --no-cache stress-ng &&
|
||||||
|
stress-ng -m 1 --vm-bytes 256M
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 100Mi
|
||||||
|
limits:
|
||||||
|
memory: 200Mi
|
||||||
Loading…
x
Reference in New Issue
Block a user