Skip to content

Commit a204043

Browse files
committed
Translate tasks/run-application/run-stateless-application-deployment.md in Korean
1 parent 0e5cbec commit a204043

File tree

3 files changed

+198
-0
lines changed

3 files changed

+198
-0
lines changed
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
---
2+
title: 디플로이먼트(Deployment)로 스테이트리스 애플리케이션 실행하기
3+
min-kubernetes-server-version: v1.9
4+
content_type: tutorial
5+
weight: 10
6+
---
7+
8+
<!-- overview -->
9+
10+
이 페이지에서는 쿠버네티스 디플로이먼트 오브젝트를 사용하여 애플리케이션을 실행하는 방법을 설명한다.
11+
12+
13+
14+
15+
## {{% heading "objectives" %}}
16+
17+
18+
* nginx 디플로이먼트 생성하기
19+
* kubectl을 사용하여 디플로이먼트 정보 나열하기
20+
* 디플로이먼트 업데이트하기
21+
22+
23+
24+
25+
## {{% heading "prerequisites" %}}
26+
27+
28+
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
29+
30+
31+
32+
33+
<!-- lessoncontent -->
34+
35+
## nginx 디플로이먼트 생성하고 탐색하기
36+
37+
쿠버네티스 디플로이먼트 오브젝트를 생성하여 애플리케이션을 실행할 수 있으며,
38+
디플로이먼트에 대한 명세를 YAML 파일에 기술할 수 있다. 예를 들어 이 YAML 파일은
39+
nginx:1.14.2 도커 이미지를 실행하는 디플로이먼트에 대한 명세를 담고 있다.
40+
41+
{{< codenew file="application/deployment.yaml" >}}
42+
43+
44+
1. YAML 파일을 기반으로 디플로이먼트를 생성한다.
45+
46+
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
47+
48+
1. 디플로이먼트에 대한 정보를 살펴본다.
49+
50+
kubectl describe deployment nginx-deployment
51+
52+
출력은 다음과 유사하다.
53+
54+
Name: nginx-deployment
55+
Namespace: default
56+
CreationTimestamp: Tue, 30 Aug 2016 18:11:37 -0700
57+
Labels: app=nginx
58+
Annotations: deployment.kubernetes.io/revision=1
59+
Selector: app=nginx
60+
Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable
61+
StrategyType: RollingUpdate
62+
MinReadySeconds: 0
63+
RollingUpdateStrategy: 1 max unavailable, 1 max surge
64+
Pod Template:
65+
Labels: app=nginx
66+
Containers:
67+
nginx:
68+
Image: nginx:1.14.2
69+
Port: 80/TCP
70+
Environment: <none>
71+
Mounts: <none>
72+
Volumes: <none>
73+
Conditions:
74+
Type Status Reason
75+
---- ------ ------
76+
Available True MinimumReplicasAvailable
77+
Progressing True NewReplicaSetAvailable
78+
OldReplicaSets: <none>
79+
NewReplicaSet: nginx-deployment-1771418926 (2/2 replicas created)
80+
No events.
81+
82+
1. 디플로이먼트에 의해 생성된 파드를 나열한다.
83+
84+
kubectl get pods -l app=nginx
85+
86+
출력은 다음과 유사하다.
87+
88+
NAME READY STATUS RESTARTS AGE
89+
nginx-deployment-1771418926-7o5ns 1/1 Running 0 16h
90+
nginx-deployment-1771418926-r18az 1/1 Running 0 16h
91+
92+
1. 파드에 대한 정보를 살펴본다.
93+
94+
kubectl describe pod <pod-name>
95+
96+
`<pod-name>`은 파드 중 하나의 이름이다.
97+
98+
## 디플로이먼트 업데이트하기
99+
100+
새 YAML 파일을 적용하여 디플로이먼트를 업데이트할 수 있다. 이 YAML 파일은
101+
nginx 1.16.1을 사용하도록 디플로이먼트를 업데이트해야 함을 명시하고 있다.
102+
103+
{{< codenew file="application/deployment-update.yaml" >}}
104+
105+
1. 새 YAML 파일을 적용한다.
106+
107+
kubectl apply -f https://k8s.io/examples/application/deployment-update.yaml
108+
109+
1. 디플로이먼트가 새 이름으로 파드를 생성하고 이전 파드를 삭제하는 것을 확인한다.
110+
111+
kubectl get pods -l app=nginx
112+
113+
## 레플리카 수를 늘려 애플리케이션 확장하기
114+
115+
새 YAML 파일을 적용하여 디플로이먼트의 파드 수를 늘릴 수 있다.
116+
이 YAML 파일은 `replicas`를 4로 설정하여 디플로이먼트에
117+
4개의 파드가 있어야 함을 명시하고 있다.
118+
119+
{{< codenew file="application/deployment-scale.yaml" >}}
120+
121+
1. 새 YAML 파일을 적용한다.
122+
123+
kubectl apply -f https://k8s.io/examples/application/deployment-scale.yaml
124+
125+
1. 디플로이먼트에 4개의 파드가 있는지 확인한다.
126+
127+
kubectl get pods -l app=nginx
128+
129+
출력은 다음과 유사하다.
130+
131+
NAME READY STATUS RESTARTS AGE
132+
nginx-deployment-148880595-4zdqq 1/1 Running 0 25s
133+
nginx-deployment-148880595-6zgi1 1/1 Running 0 25s
134+
nginx-deployment-148880595-fxcez 1/1 Running 0 2m
135+
nginx-deployment-148880595-rwovn 1/1 Running 0 2m
136+
137+
## 디플로이먼트 삭제하기
138+
139+
이름으로 디플로이먼트를 삭제한다.
140+
141+
kubectl delete deployment nginx-deployment
142+
143+
## ReplicationControllers -- 예전 방식
144+
145+
애플리케이션을 복제하여 생성하는 기본적인 방법은 내부적으로 레플리카셋(ReplicaSet)을 활용하는 디플로이먼트를
146+
사용하는 것이다. 쿠버네티스에 디플로이먼트 및 레플리카셋이 도입되기 전에는
147+
[레플리케이션컨트롤러(ReplicationController)](/ko/docs/concepts/workloads/controllers/replicationcontroller/)를 사용하여 복제 애플리케이션을
148+
구성했었다.
149+
150+
151+
152+
153+
## {{% heading "whatsnext" %}}
154+
155+
156+
* [디플로이먼트 오브젝트](/ko/docs/concepts/workloads/controllers/deployment/)에 대해 더 배워보기
157+
158+
159+
160+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx-deployment
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: nginx
9+
replicas: 4 # Update the replicas from 2 to 4
10+
template:
11+
metadata:
12+
labels:
13+
app: nginx
14+
spec:
15+
containers:
16+
- name: nginx
17+
image: nginx:1.14.2
18+
ports:
19+
- containerPort: 80
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx-deployment
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: nginx
9+
replicas: 2
10+
template:
11+
metadata:
12+
labels:
13+
app: nginx
14+
spec:
15+
containers:
16+
- name: nginx
17+
image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1
18+
ports:
19+
- containerPort: 80

0 commit comments

Comments
 (0)