์ƒ์„ธ ์ปจํ…์ธ 

๋ณธ๋ฌธ ์ œ๋ชฉ

[์ฟ ๋ฒ„๋„คํ‹ฐ์Šค] ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๋ฆฌ์†Œ์Šค ๊ตฌ์กฐ ์ดํ•ดํ•˜๊ธฐ - kind, metadata, spec

๐Ÿ˜Ž ์ง€์‹ in Action/โ˜๏ธ ๐Ÿ–ฅ๏ธ

by :ํ•ดํ”ผ๋ž˜๋น—๐Ÿพ 2026. 2. 24. 09:25

๋ณธ๋ฌธ

๋ชจ๋“  ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๋ฆฌ์†Œ์Šค๋Š” 4๊ฐ€์ง€ ์ตœ์ƒ์œ„ ํ•„๋“œ๋ฅผ ๊ฐ€์ง„๋‹ค 

apiVersion:
kind:
metadata:
spec:

 

https://kubernetes.io/docs/concepts/overview/working-with-objects/#required-fields

 

Objects In Kubernetes

Kubernetes objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster. Learn about the Kubernetes object model and how to work with these objects.

kubernetes.io

 

spec์€ ๋ฆฌ์†Œ์Šค์˜ ์›ํ•˜๋Š” ์ƒํƒœ๋ฅผ ์ •์˜ํ•˜๋Š”๋ฐ ์ด ๋ถ€๋ถ„์ด Kind๋งˆ๋‹ค ๋‹ค๋ฅด๋‹ค 

https://kubernetes.io/docs/concepts/overview/working-with-objects/#object-spec-and-status

 

Objects In Kubernetes

Kubernetes objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster. Learn about the Kubernetes object model and how to work with these objects.

kubernetes.io

 

Kind ์ข…๋ฅ˜

Wokrload ๊ด€๋ จ (์•ฑ ์‹คํ–‰)

Pod : ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰์˜ ์ตœ์†Œ ๋‹จ์œ„ (์ง€๊ธˆ ์‚ฌ์šฉ ์ค‘)

Deployment: Pod๋ฅผ ์—ฌ๋Ÿฌ ๊ฐœ ์ƒ์„ฑ/์—…๋ฐ์ดํŠธ/๋กค๋ฐฑ ๊ด€๋ฆฌ

ReplicaSet: Pod ๋ณต์ œ๋ณธ ์ˆ˜ ์œ ์ง€ (๋ณดํ†ต Deployment๊ฐ€ ์ž๋™ ๊ด€๋ฆฌ)

StatefulSet: ์ƒํƒœ๊ฐ€ ์žˆ๋Š” ์•ฑ(DB ๋“ฑ) - ์ˆœ์„œ ๋ณด์žฅ, ๊ณ ์ • ์ด๋ฆ„

DaemonSet: ๋ชจ๋“  ๋…ธ๋“œ์— Pod 1๊ฐœ์”ฉ ์‹คํ–‰ (๋กœ๊ทธ ์ˆ˜์ง‘, ๋ชจ๋‹ˆํ„ฐ๋ง ๋“ฑ)

Job : ํ•œ ๋ฒˆ ์‹คํ–‰ํ•˜๊ณ  ๋๋‚˜๋Š” ์ž‘์—…

CronJob : ์Šค์ผ€์ค„์— ๋”ฐ๋ผ ๋ฐ˜๋ณต ์‹คํ–‰ํ•˜๋Š” Job

 

Network (์ ‘๊ทผ/ํ†ต์‹ )

Service: Pod์— ์•ˆ์ •์ ์ธ ๋„คํŠธ์›Œํฌ ์ ‘์  ์ œ๊ณต (์ง€๊ธˆ ์‚ฌ์šฉ์ค‘)

Ingress: ์™ธ๋ถ€ HTTP ํŠธ๋ž˜ํ”ฝ์„ Service๋กœ ๋ผ์šฐํŒ… (๋„๋ฉ”์ธ/๊ฒฝ๋กœ ๊ธฐ๋ฐ˜)

NetworkPolicy: Pod๊ฐ„ ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ ์ œ์–ด (๋ฐฉํ™”๋ฒฝ)

 

Configration (์„ค์ •/์ €์žฅ)

ConfigMap : ์„ค์ •๊ฐ’ ์ €์žฅ (ํ™˜๊ฒฝ๋ณ€์ˆ˜, ์„ค์ • ํŒŒ์ผ)

Secret: ๋ฏผ๊ฐํ•œ ๋ฐ์ดํ„ฐ ์ €์žฅ (๋น„๋ฐ€๋ฒˆํ˜ธ, ํ† ํฐ)

PersistentVolume (PV) : ๋ฌผ๋ฆฌ ์Šคํ† ๋ฆฌ์ง€ 

PersistentVolumeClaim (PVC) : PV ์š”์ฒญ (Pod๊ฐ€ ์Šคํ† ๋ฆฌ์ง€ ์‚ฌ์šฉ ์‹œ)

 

 

Cluster Administration (ํด๋Ÿฌ์Šคํ„ฐ ๊ด€๋ฆฌ)

Namespace : ๋ฆฌ์†Œ์Šค๋ฅผ ๋…ผ๋ฆฌ์ ์œผ๋กœ ๋ถ„๋ฆฌ 

ServiceAccount : Pod์˜ ์ธ์ฆ ID

Role/ClusterRole : ๊ถŒํ•œ ์ •์˜ 

RoleBinding/ClusterRoleBinding : ๊ถŒํ•œ์„ SA/์‚ฌ์šฉ์ž์— ๋ถ€์—ฌ 

 

์ฃผ์š” Spec์˜ ์˜๋ฏธ

Pod์˜ spec → "์–ด๋–ค ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•  ๊ฒƒ์ธ๊ฐ€"

  spec:
    containers:
    - name: redis
      image: redis:alpine
      ports:
      - containerPort: 6379



  Service์˜ spec → "์–ด๋–ค Pod์— ์–ด๋–ป๊ฒŒ ๋„คํŠธ์›Œํฌ๋ฅผ ์—ฐ๊ฒฐํ•  ๊ฒƒ์ธ๊ฐ€"

  spec:
    type: NodePort
    ports:
    - port: 8080         # ํด๋Ÿฌ์Šคํ„ฐ ๋‚ด๋ถ€์—์„œ ์„œ๋น„์Šค ์ ‘๊ทผ ํฌํŠธ 
      targetPort: 80     # Pod์˜ ์–ด๋А ํฌํŠธ๋กœ ๋ณด๋‚ผ์ง€ 
      nodePort: 31000    # ์™ธ๋ถ€์—์„œ ์ ‘๊ทผํ•˜๋Š” ํฌํŠธ
    selector:            # label์ด ์ผ์น˜ํ•˜๋Š” Pod๋ฅผ ์ฐพ์•„ ์—ฐ๊ฒฐ
      app: redis



  Deployment์˜ spec → "Pod๋ฅผ ๋ช‡ ๊ฐœ, ์–ด๋–ป๊ฒŒ ๊ด€๋ฆฌํ•  ๊ฒƒ์ธ๊ฐ€"

  spec:
    replicas: 3
    selector:
      matchLabels:
        app: redis
    template:            # Pod ํ…œํ”Œ๋ฆฟ (์•ˆ์— ๋˜ metadata + spec)
      metadata:
        labels:
          app: redis
      spec:
        containers:
        - name: redis
          image: redis:alpine

 

 

Service -> Pod ์—ฐ๊ฒฐ ํ๋ฆ„

Service์˜ spec.selector.{key} : {value} == Pod์˜ metadata.labels.{key} : {value}

https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service

 

Service

Expose an application running in your cluster behind a single outward-facing endpoint, even when the workload is split across multiple backends.

kubernetes.io

https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

 

 

728x90

๊ด€๋ จ๊ธ€ ๋”๋ณด๊ธฐ