Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
iconfalse
Code Block
linenumberstrue
sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f statefulset.yaml 
service/nginx-stps created
statefulset.apps/web created
sansae@sansaeAir15m2 k8s-lab-workspace % k get all
NAME        READY   STATUS    RESTARTS   AGE
pod/web-0   0/1     Pending   0          3s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.0.0.1     <none>        443/TCP   29s
service/nginx-stps        ClusterIP   None         <none>        80/TCP    3s

NAME                   READY   AGE
statefulset.apps/web   0/3     3s

sansae@sansaeAir15m2 k8s-lab-workspace % k get all         
NAME        READY   STATUS    RESTARTS   AGE
pod/web-0   1/1     Running   0          2m47s
pod/web-1   1/1     Running   0          117s
pod/web-2   1/1     Running   0          97s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.0.0.1     <none>        443/TCP   3m13s
service/nginx-stps        ClusterIP   None         <none>        80/TCP    2m47s

NAME                   READY   AGE
statefulset.apps/web   3/3     2m47s

sansae@sansaeAir15m2 k8s-lab-workspace % k get statefulset
NAME   READY   AGE
web    3/3     48m

sansae@sansaeAir15m2 k8s-lab-workspace % k describe statefulset web 
Name:               web
Namespace:          default
CreationTimestamp:  Sat, 09 Mar 2024 21:52:14 +0900
Selector:           app=nginx
Labels:             <none>
Annotations:        <none>
Replicas:           3 desired | 3 total
Update Strategy:    RollingUpdate
  Partition:        0
Pods Status:        3 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:  app=nginx
  Containers:
   nginx:
    Image:        registry.k8s.io/nginx-slim:0.8
    Port:         80/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /usr/share/nginx/html from www (rw)
  Volumes:  <none>
Volume Claims:
  Name:          www
  StorageClass:  azurefile
  Labels:        <none>
  Annotations:   <none>
  Capacity:      1Gi
  Access Modes:  [ReadWriteOnce]
Events:
  Type    Reason            Age   From                    Message
  ----    ------            ----  ----                    -------
  Normal  SuccessfulCreate  48m   statefulset-controller  create Claim www-web-0 Pod web-0 in StatefulSet web success
  Normal  SuccessfulCreate  48m   statefulset-controller  create Pod web-0 in StatefulSet web successful
  Normal  SuccessfulCreate  47m   statefulset-controller  create Claim www-web-1 Pod web-1 in StatefulSet web success
  Normal  SuccessfulCreate  47m   statefulset-controller  create Pod web-1 in StatefulSet web successful
  Normal  SuccessfulCreate  47m   statefulset-controller  create Claim www-web-2 Pod web-2 in StatefulSet web success
  Normal  SuccessfulCreate  47m   statefulset-controller  create Pod web-2 in StatefulSet web successful

# Headless Service확인
sansae@sansaeAir15m2 k8s-lab-workspace % k exec -it util -- bash
root@util:/# curl nginx-stps
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.11.1</center>
</body>
</html>

root@util:/# nslookup nginx-stps
Server:		10.0.0.10
Address:	10.0.0.10#53

Name:	nginx-stps.default.svc.cluster.local
Address: 10.244.0.106
Name:	nginx-stps.default.svc.cluster.local
Address: 10.244.0.107
Name:	nginx-stps.default.svc.cluster.local
Address: 10.244.0.108

root@util:/# exit

sansae@sansaeAir15m2 k8s-lab-workspace % k get pod -o wide
NAME    READY   STATUS    RESTARTS   AGE     IP             NODE                                NOMINATED NODE   READINESS GATES
util    1/1     Running   0          14m     10.244.0.105   aks-agentpool-33019784-vmss000000   <none>           <none>
web-0   1/1     Running   0          8m4s    10.244.0.106   aks-agentpool-33019784-vmss000000   <none>           <none>
web-1   1/1     Running   0          7m44s   10.244.0.107   aks-agentpool-33019784-vmss000000   <none>           <none>
web-2   1/1     Running   0          7m24s   10.244.0.108   aks-agentpool-33019784-vmss000000   <none>           <none>


...