Versions Compared

Key

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

...

Info
titlehttp://wiki.ciscolinux.co.uk/index.php/Kubernetes/Deployment,_ReplicaSet_and_Pod

Image Added


Info
iconfalse

https://dev-k8sref-io.web.app/docs/workloads/deployment-v1/

Info
iconfalse
  • apiVersion: 쿠버네티스 API버전을 가리킴

  • kind: 리소스 유형

  • metadata (ObjectMeta): 포드와 관련된 이름, 네임스페이스, 라벨, 그밖의 정보

    • namespace
    • name
    • labels
  • spec (DeploymentSpec): PodTemplate

    • template

      • metadata
        • name
        • labels
      • spec
        • containers
        • volumes
    • selector

    • replicas

    • strategy: RollingUpdate(default)
  • status(DeploymentStatus) : 포드의 상태, 각 컨테이너의 설명 및 상태, 포드 내부의 IP 및 그밖의 기본 정보 등
Code Block
titlenginx-rs.yaml
linenumberstrue
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deploy
  labels:
    app: myapp-deploy
    type: front-end
spec:
  template:
    metadata:
      name: nginx
      labels:
        app: myapp
        type: front-end
    spec:
      containers:
        - name: nginx
          image: nginx:1.14.2
          ports:
            - containerPort: 80
  selector:
    matchLabels:
      type: front-end
  replicas: 3


Code Block
k create deployment --image=nginx nginx --dry-run=client -o yaml > nginx-deploy.yaml
Code Block
sansae@sansaeAir15m2 ~ % k apply -f nginx-deploy.yaml 
deployment.apps/nginx-deploy created
sansae@sansaeAir15m2 ~ % k get all
NAME                               READY   STATUS    RESTARTS   AGE
pod/nginx-deploy-d4d6c7dd8-4zx7v   1/1     Running   0          3s
pod/nginx-deploy-d4d6c7dd8-m6p7j   1/1     Running   0          3s
pod/nginx-deploy-d4d6c7dd8-rm5hj   1/1     Running   0          3s

NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.0.0.1     <none>        443/TCP   8h

NAME                           READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/nginx-deploy   3/3     3            3           3s

NAME                                     DESIRED   CURRENT   READY   AGE
replicaset.apps/nginx-deploy-d4d6c7dd8   3         3         3       3s

Deployment Strategy

Info

Image Added

Code Block
k set image deployment/nginx-deploy nginx=1.17.1