controlplane ~ ➜ k run nginx-pod --image=nginx:alpine
pod/nginx-pod created
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
nginx-pod 1/1 Running 0 3s
controlplane ~ ➜ k describe po nginx-pod
Name: nginx-pod
Namespace: default
Priority: 0
Service Account: default
Node: controlplane/192.4.145.9
Start Time: Mon, 08 Jul 2024 04:09:06 +0000
Labels: run=nginx-pod
Annotations: <none>
Status: Running
IP: 10.244.0.4
IPs:
IP: 10.244.0.4
Containers:
nginx-pod:
Container ID: containerd://248e912896a33ff427a18acb84f167b4b094a8900f335b5005bd8222bf2362cf
Image: nginx:alpine
<k run --help 명령어 사용>
Use "kubectl options" for a list of global command-line options (applies to all commands).
controlplane ~ ➜ kubectl run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"^C
controlplane ~ ✖ k run messaging --image=redis:alpine --labels=tier=msg
pod/messaging created
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
messaging 0/1 ContainerCreating 0 6s
nginx-pod 1/1 Running 0 2m36s
controlplane ~ ➜ k describe po messaging
Name: messaging
Namespace: default
Priority: 0
Service Account: default
Node: controlplane/192.4.145.9
Start Time: Mon, 08 Jul 2024 04:11:36 +0000
Labels: tier=msg
Annotations: <none>
Status: Running
IP: 10.244.0.5
IPs:
IP: 10.244.0.5
Containers:
messaging:
controlplane ~ ✖ k get ns
NAME STATUS AGE
default Active 109m
kube-flannel Active 109m
kube-node-lease Active 109m
kube-public Active 109m
kube-system Active 109m
controlplane ~ ➜ k create ns apx-x9984574
namespace/apx-x9984574 created
controlplane ~ ➜ k get ns
NAME STATUS AGE
apx-x9984574 Active 4s
default Active 109m
kube-flannel Active 109m
kube-node-lease Active 109m
kube-public Active 109m
kube-system Active 109m
controlplane ~ ➜ k get no
NAME STATUS ROLES AGE VERSION
controlplane Ready control-plane 110m v1.30.0
controlplane ~ ➜ k get no -o json
{
"apiVersion": "v1",
"items": [
{
"apiVersion": "v1",
"kind": "Node",
"metadata": {
"annotations": {
"flannel.alpha.coreos.com/backend-data": "{\"VNI\":1,\"VtepMAC\":\"b6:66:c3:d9:d9:27\"}",
"flannel.alpha.coreos.com/backend-type": "vxlan",
"flannel.alpha.coreos.com/kube-subnet-manager": "true",
.
.
.
],
"kind": "List",
"metadata": {
"resourceVersion": ""
}
}
⭐️ json 파일을 해당 경로에 복사
controlplane ~ ➜ k get no -o json > /opt/outputs/nodes-z3444kd9.json.
controlplane ~ ➜ cat /opt/outputs/nodes-z3444kd9.json.
{
"apiVersion": "v1",
"items": [
{
"apiVersion": "v1",
"kind": "Node",
"metadata": {
"annotations": {
"flannel.alpha.coreos.com/backend-data": "{\"VNI\":1,\"VtepMAC\":\"b6:66:c3:d9:d9:27\"}",
"flannel.alpha.coreos.com/backend-type": "vxlan",
"flannel.alpha.coreos.com/kube-subnet-manager": "true",
"flannel.alpha.coreos.com/public-ip": "192.4.145.9",
"kubeadm.alpha.kubernetes.io/cri-socket": "unix:///var/run/containerd/containerd.sock",
"node.alpha.kubernetes.io/ttl": "0",
"volumes.kubernetes.io/controller-managed-attach-detach": "true"
},
"creationTimestamp": "2024-07-08T02:24:59Z",
k expose --help
사용
메세지 어플리케이션 접속을 위해 메세지-서비스를 만들어 클러스터 안에 있는 메세지 파드 IP와 서비스 연결
controlplane ~ ➜ k expose po messaging --port 6379 --name messaging-service
service/messaging-service exposed
controlplane ~ ➜ k get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 120m
messaging-service ClusterIP 10.108.125.130 <none> 6379/TCP 5s
controlplane ~ ➜ k describe svc messaging-service
Name: messaging-service
Namespace: default
Labels: tier=msg
Annotations: <none>
Selector: tier=msg
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.108.125.130
IPs: 10.108.125.130
Port: <unset> 6379/TCP
TargetPort: 6379/TCP
Endpoints: 10.244.0.5:6379 ⭐️ endppoint 확인
Session Affinity: None
Events: <none>
controlplane ~ ➜ k get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
messaging 1/1 Running 0 14m ⭐️10.244.0.5 controlplane <none> <none>
nginx-pod 1/1 Running 0 16m 10.244.0.4 controlplane <none> <none>
controlplane ~ ➜
controlplane ~ ➜ k create deployment hr-web-app --image=kodekloud/webapp-color --replicas=2
deployment.apps/hr-web-app created
controlplane ~ ➜ k get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
hr-web-app 0/2 2 0 7s
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-tblmg 1/1 Running 0 17s
hr-web-app-5d6b77db78-w8f64 1/1 Running 0 17s
messaging 1/1 Running 0 16m
nginx-pod 1/1 Running 0 19m
controlplane ~ ➜ k describe deploy hr-web-app
Name: hr-web-app
Namespace: default
CreationTimestamp: Mon, 08 Jul 2024 04:28:08 +0000
Labels: app=hr-web-app
Annotations: deployment.kubernetes.io/revision: 1
Selector: app=hr-web-app
Replicas: 확인 ⭐️ 2 desired | 2 updated | 2 total | 2 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
controlplane ~ ➜ k run static-busybox --image=busybox --dry-run=client -o yaml --comand -- sleep, 1000
error: unknown flag: --comand
See 'kubectl run --help' for usage.
controlplane ~ ✖ k run static-busybox --image=busybox --dry-run=client -o yaml --command -- sleep 1000
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: static-busybox
name: static-busybox
spec:
containers:
- command:
- sleep
- "1000"
image: busybox
name: static-busybox
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
controlplane ~ ➜ k run static-busybox --image=busybox --dry-run=client -o yaml --command -- sleep 1000 > static-busybox.yaml
controlplane ~ ➜ ls
sample.yaml static-busybox.yaml
controlplane ~ ➜ cat static-busybox.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: static-busybox
name: static-busybox
spec:
containers:
- command:
- sleep
- "1000"
image: busybox
name: static-busybox
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
controlplane ~ ➜ k create -f static-busybox.yaml
pod/static-busybox created
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-tblmg 1/1 Running 0 16m
hr-web-app-5d6b77db78-w8f64 1/1 Running 0 16m
messaging 1/1 Running 0 33m
nginx-pod 1/1 Running 0 35m
static-busybox 1/1 Running 0 5s
###### ⭐️ static 경로에 두지 않으면 삭제되어도 다시 생기지 않음
controlplane ~ ➜ k delete po static-busybox
pod "static-busybox" deleted
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-tblmg 1/1 Running 0 17m
hr-web-app-5d6b77db78-w8f64 1/1 Running 0 17m
messaging 1/1 Running 0 34m
nginx-pod 1/1 Running 0 36m
controlplane ~ ➜
mv static-busybox.yaml
/etc/kubernetes/manifests/
경로 암기
controlplane ~ ➜ ls
sample.yaml static-busybox.yaml
controlplane ~ ➜ mv static-busybox.yaml /etc/kubernetes/manifests/
controlplane ~ ➜ k create -f /etc/kubernetes/manifests/static-busybox.yaml
pod/static-busybox created
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-tblmg 1/1 Running 0 20m
hr-web-app-5d6b77db78-w8f64 1/1 Running 0 20m
messaging 1/1 Running 0 37m
nginx-pod 1/1 Running 0 39m
static-busybox 1/1 Running 0 11s
static-busybox-controlplane 1/1 Running 0 48s
controlplane ~ ➜ k describe po static-busybox-controlplane
Name: static-busybox-controlplane
Namespace: default
Priority: 0
Node: controlplane/192.4.145.9
Start Time: Mon, 08 Jul 2024 04:47:58 +0000
Labels: run=static-busybox
Annotations: kubernetes.io/config.hash: 61f6c4844f8c32c1b793af0a920431c9
kubernetes.io/config.mirror: 61f6c4844f8c32c1b793af0a920431c9
kubernetes.io/config.seen: 2024-07-08T04:47:58.193630488Z
kubernetes.io/config.source: file
Status: Running
IP: 10.244.0.10
IPs:
IP: 10.244.0.10
Controlled By: Node/controlplane
Containers:
static-busybox:
Container ID: containerd://a9cfbe573713fefdd98e0b8360468ba966c031350cee7690dad40e196a3bdbaf
Image: busybox
Image ID: docker.io/library/busybox@sha256:9ae97d36d26566ff84e8893c64a6dc4fe8ca6d1144bf5b87b2b85a32def253c7
Port: <none>
Host Port: <none>
Command:
sleep
1000
State: Running
controlplane ~ ➜ k run temp-bus --image=redis:alpine -n finance
pod/temp-bus created
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-tblmg 1/1 Running 0 24m
hr-web-app-5d6b77db78-w8f64 1/1 Running 0 24m
messaging 1/1 Running 0 40m
nginx-pod 1/1 Running 0 43m
static-busybox 1/1 Running 0 3m53s
static-busybox-controlplane 1/1 Running 0 4m30s
controlplane ~ ➜ k get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
hr-web-app-5d6b77db78-tblmg 1/1 Running 0 24m 10.244.0.6 controlplane <none> <none>
hr-web-app-5d6b77db78-w8f64 1/1 Running 0 24m 10.244.0.7 controlplane <none> <none>
messaging 1/1 Running 0 41m 10.244.0.5 controlplane <none> <none>
nginx-pod 1/1 Running 0 43m 10.244.0.4 controlplane <none> <none>
static-busybox 1/1 Running 0 4m12s 10.244.0.11 controlplane <none> <none>
static-busybox-controlplane 1/1 Running 0 4m49s 10.244.0.10 controlplane <none> <none>
controlplane ~ ➜ k get po -n finance ⭐️ ns를 붙여야만 확인 가능
NAME READY STATUS RESTARTS AGE
temp-bus 1/1 Running 0
controlplane ~ ✖ k describe po temp-bus -n finance
Name: temp-bus
Namespace: finance
Priority: 0
Service Account: default
Node: controlplane/192.4.145.9
Start Time: Mon, 08 Jul 2024 04:51:51 +0000
Labels: run=temp-bus
Annotations: <none>
Status: Running
IP: 10.244.0.12
IPs:
IP: 10.244.0.12
Containers:
temp-bus:
Container ID: containerd://1232ad33519acb1be66aad503d54ffae50663e0afb9de52263809ed9e2a272ac
Image: redis:alpine
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-nvvfq 1/1 Running 0 4m17s
hr-web-app-5d6b77db78-q4tg2 1/1 Running 0 4m17s
messaging 1/1 Running 0 8m24s
nginx-pod 1/1 Running 0 15m
orange 0/1 Init:CrashLoopBackOff 3 (16s ago) 59s
static-busybox 1/1 Running 0 119s
static-busybox-controlplane 1/1 Running 0 2m21s
controlplane ~ ➜ k describe po orange
Name: orange
Namespace: default
Priority: 0
Service Account: default
Node: controlplane/192.10.141.6
Start Time: Tue, 09 Jul 2024 06:30:42 +0000
Labels: <none>
Annotations: <none>
Status: Pending
IP: 10.244.0.13
IPs:
IP: 10.244.0.13
📌Init Containers:
init-myservice:
Container ID: containerd://6a57d42900025961c790d0a31c84555b3f1ca72eec2433b4a49fe8e5e23c3615
Image: busybox
Image ID: docker.io/library/busybox@sha256:9ae97d36d26566ff84e8893c64a6dc4fe8ca6d1144bf5b87b2b85a32def253c7
Port: <none>
Host Port: <none>
Command:
sh
-c
sleeeep 2;
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 127
Started: Tue, 09 Jul 2024 06:31:25 +0000
Finished: Tue, 09 Jul 2024 06:31:25 +0000
Ready: False
Restart Count: 3
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-6bgcl (ro)
Containers:
📌 orange-container:
Container ID:
Image: busybox:1.28
Image ID:
Port: <none>
Host Port: <none>
Command:
sh
-c
echo The app is running! && sleep 3600
State: Waiting
Reason: PodInitializing 🛑 Pod 초기화중
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-6bgcl (ro)
Conditions:
Type Status
PodReadyToStartContainers True
Initialized False
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-6bgcl:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
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 64s default-scheduler Successfully assigned default/orange to controlplane
Normal Pulled 63s kubelet Successfully pulled image "busybox" in 372ms (372ms including waiting). Image size: 2160406 bytes.
Normal Pulled 62s kubelet Successfully pulled image "busybox" in 293ms (293ms including waiting). Image size: 2160406 bytes.
Normal Pulled 48s kubelet Successfully pulled image "busybox" in 284ms (284ms including waiting). Image size: 2160406 bytes.
Normal Pulling 21s (x4 over 64s) kubelet Pulling image "busybox"
Normal Created 21s (x4 over 63s) kubelet Created container init-myservice
Normal Started 21s (x4 over 63s) kubelet Started container init-myservice
Normal Pulled 21s kubelet Successfully pulled image "busybox" in 295ms (295ms including waiting). Image size: 2160406 bytes.
Warning BackOff 6s (x6 over 62s) kubelet Back-off restarting failed container init-myservice in pod orange_default(7df5e0c3-879c-44b2-a73c-b8ab542ce760)
🛑 실행주인 pod에서 sleeep-> sleep 수정
controlplane ~ ➜ k edit pod orange
error: pods "orange" is invalid
A copy of your changes has been stored to "/tmp/kubectl-edit-2975896844.yaml"
error: Edit cancelled, no valid changes were saved.
✅ 수정된 yaml을 실행중인 pod에 적용
controlplane ~ ✖ k replace --force -f /tmp/kubectl-edit-2975896844.yaml
pod "orange" deleted
pod/orange replaced
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-nvvfq 1/1 Running 0 11m
hr-web-app-5d6b77db78-q4tg2 1/1 Running 0 11m
messaging 1/1 Running 0 16m
nginx-pod 1/1 Running 0 22m
orange 1/1 Running 0 69s
static-busybox 1/1 Running 0 9m39s
static-busybox-controlplane 1/1 Running 0 10m
The web application listens on port 8080.
Usage:
kubectl expose (-f FILENAME | TYPE NAME) [--port=port]
[--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name]
[--external-ip=external-ip-of-service] [--type=type] [options]
Use "kubectl options" for a list of global command-line options (applies to all
commands).
controlplane ~ ➜ k get po
NAME READY STATUS RESTARTS AGE
hr-web-app-5d6b77db78-nvvfq 1/1 Running 0 13m
hr-web-app-5d6b77db78-q4tg2 1/1 Running 0 13m
messaging 1/1 Running 0 17m
nginx-pod 1/1 Running 0 24m
orange 1/1 Running 0 2m22s
static-busybox 1/1 Running 0 10m
static-busybox-controlplane 1/1 Running 0 11m
controlplane ~ ➜ k get no
NAME STATUS ROLES AGE VERSION
controlplane Ready control-plane 64m v1.30.0
controlplane ~ ➜ k get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
hr-web-app 2/2 2 2 13m
# expose 대상, svc이름, 적용타입, 연결 포트
controlplane ~ ➜ k expose deploy hr-web-app --name=hr-web-app-service --type NodePort --port 8080
service/hr-web-app-service exposed
controlplane ~ ➜ k get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hr-web-app-service NodePort 10.101.22.212 <none> 🛑 8080:30893/TCP 14s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 68m
messaging-service ClusterIP 10.110.161.220 <none> 6379/TCP 17m
controlplane ~ ➜ k describe svc hr-web-app-service
Name: hr-web-app-service
Namespace: default
Labels: app=hr-web-app
Annotations: <none>
Selector: app=hr-web-app
Type: NodePort
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.101.22.212
IPs: 10.101.22.212
Port: <unset> 8080/TCP
TargetPort: 8080/TCP
NodePort: <unset> 30893/TCP
Endpoints: 10.244.0.8:8080,10.244.0.9:8080 ⭐️ 2end 확인
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
⭐️ 서비스를 수정 : 30893-> 30892
controlplane ~ ➜ k edit svc hr-web-app-service
service/hr-web-app-service edited
controlplane ~ ➜ k get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hr-web-app-service NodePort 10.101.22.212 <none> 8080:30892/TCP 100s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 69m
messaging-service ClusterIP 10.110.161.220 <none> 6379/TCP 19m
kubectl expose deployment hr-web-app --type=NodePort --port=8080 --name=hr-web-app-service --dry-run=client -o yaml > hr-web-app-service.yaml
The osImages are under the nodeInfo section under status of each node.
kubenetes doc: cheat sheet
https://kubernetes.io/ko/docs/reference/kubectl/cheatsheet/# app=cassandra 레이블을 가진 모든 파드의 레이블 버전 조회 kubectl get pods --selector=app=cassandra -o \ jsonpath='{.items[*].metadata.labels.version}' < 사용
문
controlplane ~ ➜ k get no
NAME STATUS ROLES AGE VERSION
controlplane Ready control-plane 74m v1.30.0
controlplane ~ ➜ k get no -o json
{
"apiVersion": "v1",
📌 "items": [
{
"apiVersion": "v1",
"kind": "Node",
"metadata": {
"annotations": {
"flannel.alpha.coreos.com/backend-data": "{\"VNI\":1,\"VtepMAC\":\"3a:69:1b:47:d3:28\"}",
"flannel.alpha.coreos.com/backend-type": "vxlan",
"flannel.alpha.coreos.com/kube-subnet-manager": "true",
"flannel.alpha.coreos.com/public-ip": "192.10.141.6",
"kubeadm.alpha.kubernetes.io/cri-socket": "unix:///var/run/containerd/containerd.sock",
"node.alpha.kubernetes.io/ttl": "0",
"volumes.kubernetes.io/controller-managed-attach-detach": "true"
},
"creationTimestamp": "2024-07-09T05:35:51Z",
"labels": {
"beta.kubernetes.io/arch": "amd64",
"beta.kubernetes.io/os": "linux",
"kubernetes.io/arch": "amd64",
"kubernetes.io/hostname": "controlplane",
"kubernetes.io/os": "linux",
"node-role.kubernetes.io/control-plane": "",
"node.kubernetes.io/exclude-from-external-load-balancers": ""
},
"name": "controlplane",
"resourceVersion": "6358",
"uid": "60363d3c-c9a6-4a35-b79e-4637cbc864f7"
},
"spec": {
"podCIDR": "10.244.0.0/24",
"podCIDRs": [
"10.244.0.0/24"
]
},
"status": {
"addresses": [
{
"address": "192.10.141.6",
"type": "InternalIP"
},
{
"address": "controlplane",
"type": "Hostname"
}
],
"allocatable": {
"cpu": "36",
"ephemeral-storage": "936398358207",
"hugepages-1Gi": "0",
"hugepages-2Mi": "0",
"memory": "214484656Ki",
"pods": "110"
},
"capacity": {
"cpu": "36",
"ephemeral-storage": "1016057248Ki",
"hugepages-1Gi": "0",
"hugepages-2Mi": "0",
"memory": "214587056Ki",
"pods": "110"
},
"conditions": [
{
"lastHeartbeatTime": "2024-07-09T05:36:13Z",
"lastTransitionTime": "2024-07-09T05:36:13Z",
"message": "Flannel is running on this node",
"reason": "FlannelIsUp",
"status": "False",
"type": "NetworkUnavailable"
},
{
"lastHeartbeatTime": "2024-07-09T06:48:43Z",
"lastTransitionTime": "2024-07-09T05:35:47Z",
"message": "kubelet has sufficient memory available",
"reason": "KubeletHasSufficientMemory",
"status": "False",
"type": "MemoryPressure"
},
{
"lastHeartbeatTime": "2024-07-09T06:48:43Z",
"lastTransitionTime": "2024-07-09T05:35:47Z",
"message": "kubelet has no disk pressure",
"reason": "KubeletHasNoDiskPressure",
"status": "False",
"type": "DiskPressure"
},
{
"lastHeartbeatTime": "2024-07-09T06:48:43Z",
"lastTransitionTime": "2024-07-09T05:35:47Z",
"message": "kubelet has sufficient PID available",
"reason": "KubeletHasSufficientPID",
"status": "False",
"type": "PIDPressure"
},
{
"lastHeartbeatTime": "2024-07-09T06:48:43Z",
"lastTransitionTime": "2024-07-09T05:36:11Z",
"message": "kubelet is posting ready status",
"reason": "KubeletReady",
"status": "True",
"type": "Ready"
}
],
"daemonEndpoints": {
"kubeletEndpoint": {
"Port": 10250
}
},
"images": [
{
"names": [
"docker.io/kodekloud/fluent-ui-running@sha256:78fd68ba8a79adcd3e58897a933492886200be513076ba37f843008cc0168f81",
"docker.io/kodekloud/fluent-ui-running:latest"
],
"sizeBytes": 389734636
},
{
"names": [
"docker.io/library/nginx@sha256:ed6d2c43c8fbcd3eaa44c9dab6d94cb346234476230dc1681227aa72d07181ee",
"docker.io/library/nginx:latest"
],
"sizeBytes": 70991807
},
{
"names": [
"registry.k8s.io/etcd@sha256:44a8e24dcbba3470ee1fee21d5e88d128c936e9b55d4bc51fbef8086f8ed123b",
"registry.k8s.io/etcd:3.5.12-0"
],
"sizeBytes": 57236178
},
{
"names": [
"registry.k8s.io/kube-apiserver@sha256:6b8e197b2d39c321189a475ac755a77896e34b56729425590fbc99f3a96468a3",
"registry.k8s.io/kube-apiserver:v1.30.0"
],
"sizeBytes": 32663599
},
{
"names": [
"docker.io/kodekloud/webapp-color@sha256:99c3821ea49b89c7a22d3eebab5c2e1ec651452e7675af243485034a72eb1423",
"docker.io/kodekloud/webapp-color:latest"
],
"sizeBytes": 31777918
},
{
"names": [
"registry.k8s.io/kube-controller-manager@sha256:5f52f00f17d5784b5ca004dffca59710fa1a9eec8d54cebdf9433a1d134150fe",
"registry.k8s.io/kube-controller-manager:v1.30.0"
],
"sizeBytes": 31030110
},
{
"names": [
"docker.io/weaveworks/weave-kube@sha256:d797338e7beb17222e10757b71400d8471bdbd9be13b5da38ce2ebf597fb4e63",
"docker.io/weaveworks/weave-kube:2.8.1"
],
"sizeBytes": 30924173
},
{
"names": [
"registry.k8s.io/kube-proxy@sha256:ec532ff47eaf39822387e51ec73f1f2502eb74658c6303319db88d2c380d0210",
"registry.k8s.io/kube-proxy:v1.30.0"
],
"sizeBytes": 29020473
},
{
"names": [
"docker.io/flannel/flannel@sha256:c951947891d7811a4da6bf6f2f4dcd09e33c6e1eb6a95022f3f621d00ed4615e",
"docker.io/flannel/flannel:v0.23.0"
],
"sizeBytes": 28051548
},
{
"names": [
"docker.io/library/nginx@sha256:fdbfdaea4fc323f44590e9afeb271da8c345a733bf44c4ad7861201676a95f42",
"docker.io/library/nginx:alpine"
],
"sizeBytes": 20461204
},
{
"names": [
"registry.k8s.io/kube-scheduler@sha256:2353c3a1803229970fcb571cffc9b2f120372350e01c7381b4b650c4a02b9d67",
"registry.k8s.io/kube-scheduler:v1.30.0"
],
"sizeBytes": 19208660
},
{
"names": [
"registry.k8s.io/coredns/coredns@sha256:1eeb4c7316bacb1d4c8ead65571cd92dd21e27359f0d4917f1a5822a73b75db1",
"registry.k8s.io/coredns/coredns:v1.11.1"
],
"sizeBytes": 18182961
},
{
"names": [
"docker.io/library/redis@sha256:de14eedfbd1fc871d0f5aa1773fd80743930e45354d035b6f3b551e7ffa44df8",
"docker.io/library/redis:alpine"
],
"sizeBytes": 16801716
},
{
"names": [
"registry.k8s.io/coredns/coredns@sha256:a0ead06651cf580044aeb0a0feba63591858fb2e43ade8c9dea45a6a89ae7e5e",
"registry.k8s.io/coredns/coredns:v1.10.1"
],
"sizeBytes": 16190758
},
{
"names": [
"docker.io/weaveworks/weave-npc@sha256:38d3e30a97a2260558f8deb0fc4c079442f7347f27c86660dbfc8ca91674f14c",
"docker.io/weaveworks/weave-npc:2.8.1"
],
"sizeBytes": 12814131
},
{
"names": [
"docker.io/flannel/flannel-cni-plugin@sha256:ca6779c6ad63b77af8a00151cefc08578241197b9a6fe144b0e55484bc52b852",
"docker.io/flannel/flannel-cni-plugin:v1.2.0"
],
"sizeBytes": 3879095
},
{
"names": [
"docker.io/library/busybox@sha256:9ae97d36d26566ff84e8893c64a6dc4fe8ca6d1144bf5b87b2b85a32def253c7",
"docker.io/library/busybox:latest"
],
"sizeBytes": 2160406
},
{
"names": [
"docker.io/library/busybox@sha256:c3839dd800b9eb7603340509769c43e146a74c63dca3045a8e7dc8ee07e53966"
],
"sizeBytes": 2160005
},
{
"names": [
"docker.io/library/busybox@sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47",
"docker.io/library/busybox:1.28"
],
"sizeBytes": 727869
},
{
"names": [
"registry.k8s.io/pause@sha256:7031c1b283388d2c2e09b57badb803c05ebed362dc88d84b480cc47f72a21097",
"registry.k8s.io/pause:3.9"
],
"sizeBytes": 321520
},
{
"names": [
"registry.k8s.io/pause@sha256:3d380ca8864549e74af4b29c10f9cb0956236dfb01c40ca076fb6c37253234db",
"registry.k8s.io/pause:3.6"
],
"sizeBytes": 301773
}
],
📌 "nodeInfo": {
"architecture": "amd64",
"bootID": "aabdead6-7ad3-48f4-9e4e-e7d012582f1e",
"containerRuntimeVersion": "containerd://1.6.26",
"kernelVersion": "5.4.0-1106-gcp",
"kubeProxyVersion": "v1.30.0",
"kubeletVersion": "v1.30.0",
"machineID": "19d93cf879df4a7dbff7fb9eabd1279f",
"operatingSystem": "linux",
📌 "osImage": "Ubuntu 22.04.4 LTS",
"systemUUID": "1a5d0c79-cc3c-637d-7715-012ff9847f27"
}
}
}
],
"kind": "List",
"metadata": {
"resourceVersion": ""
}
}
controlplane ~ ➜ k get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}'
Ubuntu 22.04.4 LTS
controlplane ~ ➜
controlplane ~ ➜ k get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}' > /opt/outputs/nodes_os_x43kj56.txt
controlplane ~ ➜ cat /opt/outputs/nodes_os_x43kj56.txt
Ubuntu 22.04.4 LTS
Volume name: pv-analytics
Storage: 100Mi
Access mode: ReadWriteMany
Host path: /pv/data-analytics
pv 검색
https://kubernetes.io/docs/concepts/storage/persistent-volumes/apiVersion: v1 kind: PersistentVolume metadata: name: pv0003 spec: capacity: storage: 5Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Recycle storageClassName: slow
controlplane ~ ➜ ls
sample.yaml
controlplane ~ ➜ vi pv.yaml
controlplane ~ ➜ cat pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-analytics
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteMany
hostPath:
path: /pv/data-analytics
controlplane ~ ➜ k create -f pv.yaml
persistentvolume/pv-analytics created
controlplane ~ ➜ k get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS VOLUMEATTRIBUTESCLASS REASON AGE
pv-analytics 100Mi RWX Retain Available <unset> 3s
controlplane ~ ➜ k describe pv
Name: pv-analytics
Labels: <none>
Annotations: <none>
Finalizers: [kubernetes.io/pv-protection]
StorageClass:
Status: Available
Claim:
Reclaim Policy: Retain
Access Modes: RWX
VolumeMode: Filesystem
Capacity: 100Mi
Node Affinity: <none>
Message:
Source:
Type: HostPath (bare host directory volume)
Path: /pv/data-analytics
HostPathType:
Events: <none>