Pod

Pod erőforás dokumentáció megjelenítése

kubectl explain pod

Egyszerű pod létrehozása egy konténerrel parancssorból

kubectl run nginx-pod --image=registry.r-l.hu/library/nginx:latest --restart=Never

Egyszerű pod létrehozása egy konténerrel yaml fájlból

cat > egyszeru-pod-egy-kontenerrel.yaml <<EOF
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
spec:
containers:
- name: nginx
image: registry.r-l.hu/library/nginx:latest
EOF

Konténer indítása

kubectl apply -f egyszeru-pod-egy-kontenerrel.yaml
pod/nginx-pod created
kubectl wait --for=condition=Ready pod/nginx-pod --timeout=90s
pod/nginx-pod condition met

Konténer ellenőrzése

kubectl get pod/nginx-pod -o yaml

kubectl describe pod/nginx-pod
Name: nginx-pod
Namespace: default
Priority: 0
Service Account: default
Node: worker01.r-logic.eu/185.207.251.233
Start Time: Tue, 16 Sep 2025 04:33:07 +0200
Labels: run=nginx-pod
Annotations: <none>
Status: Running
IP: 10.244.1.14
IPs:
IP: 10.244.1.14
Containers:
nginx-pod:
Container ID: containerd://406b1f5856e2bfaa9e91d391078458c56e64c2f9d068f9b65dbab4d3c0b44e8b
Image: registry.r-l.hu/library/nginx:latest
Image ID: registry.r-l.hu/library/nginx@sha256:d5f28ef21aabddd098f3dbc21fe5b7a7d7a184720bc07da0b6c9b9820e97f25e
Port: <none>
Host Port: <none>
State: Running
Started: Tue, 16 Sep 2025 04:33:14 +0200
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-f79p9 (ro)
Conditions:
Type Status
PodReadyToStartContainers True
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-f79p9:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
Optional: false
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 53s default-scheduler Successfully assigned default/nginx-pod to worker01.r-logic.eu
Normal Pulling 52s kubelet Pulling image "registry.r-l.hu/library/nginx:latest"
Normal Pulled 46s kubelet Successfully pulled image "registry.r-l.hu/library/nginx:latest" in 5.622s (5.622s including waiting). Image size: 72319182 bytes.
Normal Created 46s kubelet Created container: nginx-pod
Normal Started 46s kubelet Started container nginx-pod

Konténer nevének kiolvasása

kubectl get pod/nginx-pod -o jsonpath='{.spec.containers[*].name}'

Utasítások futtatása a konténerben

kubectl exec -it pod/nginx-pod -c nginx -- sh

Naplók megtekintése

kubectl logs pod/nginx-pod

kubectl logs pod/nginx-pod -c nginx

Port tesztelése

kubectl port-forward pod/nginx-pod 8080:80

Egyszer használatos pod tesztelésekhez

kubectl run debug-pod --rm -it --image=registry.r-l.hu/library/busybox:1.36 --restart=Never -- sh

Deployment

Deployment létrehozása parancssorból

kubectl create deployment nginx-deployment --image=registry.r-l.hu/library/nginx:latest && kubectl wait --for=condition=Available deployment/nginx-deployment --timeout=90s
deployment.apps/nginx-deployment created
deployment.apps/nginx-deployment condition met

Deployment példányok módosítása