Skip to content

Commit fde75d6

Browse files
authored
Merge pull request #30272 from bang9211/bang9211/ingress-minikube/v0.2
[ko] Translate tasks/access-application-cluster/ingress-minikube.md in Korean
2 parents e4509e7 + c739af9 commit fde75d6

File tree

2 files changed

+337
-0
lines changed

2 files changed

+337
-0
lines changed
Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
---
2+
title: NGINX 인그레스(Ingress) 컨트롤러로 Minikube에서 인그레스 설정하기
3+
content_type: task
4+
weight: 100
5+
---
6+
7+
<!-- overview -->
8+
9+
[인그레스](/ko/docs/concepts/services-networking/ingress/)는 클러스터의 서비스에 대한 외부 액세스를 허용하는 규칙을 정의하는
10+
API 객체이다. [인그레스 컨트롤러](/ko/docs/concepts/services-networking/ingress-controllers/)는 인그레스에 설정된 규칙을 이행한다.
11+
12+
이 페이지에서는 HTTP URI에 따라 요청을 Service web 또는 web2로 라우팅하는 간단한 인그레스를 설정하는 방법을 보여준다.
13+
14+
15+
16+
## {{% heading "prerequisites" %}}
17+
18+
19+
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
20+
21+
22+
23+
<!-- steps -->
24+
25+
## Minikube 클러스터 생성하기
26+
27+
1. **터미널 실행**을 클릭한다.
28+
29+
{{< kat-button >}}
30+
31+
1. (선택 사항) Minikube를 로컬로 설치한 경우 다음 명령을 실행한다.
32+
33+
```shell
34+
minikube start
35+
```
36+
37+
## 인그레스 컨트롤러 활성화
38+
39+
1. NGINX 인그레스 컨트롤러를 활성화하기 위해 다음 명령을 실행한다.
40+
41+
```shell
42+
minikube addons enable ingress
43+
```
44+
45+
1. NGINX 인그레스 컨트롤러가 실행 중인지 확인한다.
46+
47+
48+
{{< tabs name="tab_with_md" >}}
49+
{{% tab name="minikube v1.19 or later" %}}
50+
```shell
51+
kubectl get pods -n ingress-nginx
52+
```
53+
{{< note >}}이 작업은 1분 정도 소요될 수 있다.{{< /note >}}
54+
55+
Output:
56+
57+
```
58+
NAME READY STATUS RESTARTS AGE
59+
ingress-nginx-admission-create-g9g49 0/1 Completed 0 11m
60+
ingress-nginx-admission-patch-rqp78 0/1 Completed 1 11m
61+
ingress-nginx-controller-59b45fb494-26npt 1/1 Running 0 11m
62+
```
63+
{{% /tab %}}
64+
65+
{{% tab name="minikube v1.18.1 or earlier" %}}
66+
```shell
67+
kubectl get pods -n kube-system
68+
```
69+
{{< note >}}이 작업은 1분 정도 소요될 수 있다.{{< /note >}}
70+
71+
Output:
72+
73+
```
74+
NAME READY STATUS RESTARTS AGE
75+
default-http-backend-59868b7dd6-xb8tq 1/1 Running 0 1m
76+
kube-addon-manager-minikube 1/1 Running 0 3m
77+
kube-dns-6dcb57bcc8-n4xd4 3/3 Running 0 2m
78+
kubernetes-dashboard-5498ccf677-b8p5h 1/1 Running 0 2m
79+
nginx-ingress-controller-5984b97644-rnkrg 1/1 Running 0 1m
80+
storage-provisioner 1/1 Running 0 2m
81+
```
82+
{{% /tab %}}
83+
{{< /tabs >}}
84+
85+
86+
87+
```shell
88+
kubectl get pods -n ingress-nginx
89+
```
90+
91+
{{< note >}}이 작업은 1분 정도 소요될 수 있다.{{< /note >}}
92+
93+
Output:
94+
95+
```shell
96+
NAME READY STATUS RESTARTS AGE
97+
ingress-nginx-admission-create-2tgrf 0/1 Completed 0 3m28s
98+
ingress-nginx-admission-patch-68b98 0/1 Completed 0 3m28s
99+
ingress-nginx-controller-59b45fb494-lzmw2 1/1 Running 0 3m28s
100+
```
101+
102+
103+
## hello, world 앱 배포하기
104+
105+
1. 다음 명령을 사용하여 디플로이먼트(Deployment)를 생성한다.
106+
107+
```shell
108+
kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0
109+
```
110+
111+
Output:
112+
113+
```shell
114+
deployment.apps/web created
115+
```
116+
117+
1. 디플로이먼트를 노출시킨다.
118+
119+
```shell
120+
kubectl expose deployment web --type=NodePort --port=8080
121+
```
122+
123+
Output:
124+
125+
```shell
126+
service/web exposed
127+
```
128+
129+
1. 서비스(Service)가 생성되고 노드 포트에서 사용할 수 있는지 확인한다.
130+
131+
```shell
132+
kubectl get service web
133+
```
134+
135+
Output:
136+
137+
```shell
138+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
139+
web NodePort 10.104.133.249 <none> 8080:31637/TCP 12m
140+
```
141+
142+
1. 노드포트(NodePort)를 통해 서비스에 접속한다.
143+
144+
```shell
145+
minikube service web --url
146+
```
147+
148+
Output:
149+
150+
```shell
151+
http://172.17.0.15:31637
152+
```
153+
154+
{{< note >}}Katacoda 환경만 해당: 터미널 패널 상단에서 더하기 기호를 클릭한 다음 **Select port to view on Host 1**을 클릭한다. 노드포트(이 경우 '31637')를 입력한 다음 **Display Port**를 클릭한다.{{< /note >}}
155+
156+
Output:
157+
158+
```shell
159+
Hello, world!
160+
Version: 1.0.0
161+
Hostname: web-55b8c6998d-8k564
162+
```
163+
164+
이제 Minikube IP 주소와 노드포트를 통해 샘플 앱에 액세스할 수 있다. 다음 단계에서는
165+
인그레스 리소스를 사용하여 앱에 액세스할 수 있다.
166+
167+
## 인그레스 리소스 생성하기
168+
169+
다음 파일은 hello-world.info를 통해 서비스로 트래픽을 보내는 인그레스 리소스다.
170+
171+
1. 다음 파일을 통해 `example-ingress.yaml`을 만든다.
172+
173+
{{< codenew file="service/networking/example-ingress.yaml" >}}
174+
175+
1. 다음 명령어를 실행하여 인그레스 리소스를 생성한다.
176+
177+
```shell
178+
kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml
179+
```
180+
181+
Output:
182+
183+
```shell
184+
ingress.networking.k8s.io/example-ingress created
185+
```
186+
187+
1. IP 주소가 설정되었는지 확인한다.
188+
189+
```shell
190+
kubectl get ingress
191+
```
192+
193+
{{< note >}}이 작업은 몇 분 정도 소요될 수 있다.{{< /note >}}
194+
195+
```shell
196+
NAME CLASS HOSTS ADDRESS PORTS AGE
197+
example-ingress <none> hello-world.info 172.17.0.15 80 38s
198+
```
199+
200+
1. `/etc/hosts` 파일의 맨 아래에 다음 행을 추가한다.
201+
202+
{{< note >}}Minikube를 로컬에서 실행하는 경우 'minikube ip'를 사용하여 외부 IP를 가져온다. 인그레스 목록에 표시되는 IP 주소는 내부 IP가 된다.{{< /note >}}
203+
204+
```
205+
172.17.0.15 hello-world.info
206+
```
207+
208+
이것은 hello-world.info에서 Minikube로 요청을 보낸다.
209+
210+
1. 인그레스 컨트롤러가 트래픽을 전달하는지 확인한다.
211+
212+
```shell
213+
curl hello-world.info
214+
```
215+
216+
Output:
217+
218+
```shell
219+
Hello, world!
220+
Version: 1.0.0
221+
Hostname: web-55b8c6998d-8k564
222+
```
223+
224+
{{< note >}}Minikube를 로컬에서 실행하는 경우 브라우저에서 hello-world.info에 접속할 수 있다.{{< /note >}}
225+
226+
## 두 번째 디플로이먼트 생성하기
227+
228+
1. 다음 명령을 사용하여 v2 디플로이먼트를 생성한다.
229+
230+
```shell
231+
kubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0
232+
```
233+
Output:
234+
235+
```shell
236+
deployment.apps/web2 created
237+
```
238+
239+
1. 디플로이먼트를 노출시킨다.
240+
241+
```shell
242+
kubectl expose deployment web2 --port=8080 --type=NodePort
243+
```
244+
245+
Output:
246+
247+
```shell
248+
service/web2 exposed
249+
```
250+
251+
## 인그레스 수정하기
252+
253+
1. 기존 `example-ingress.yaml`을 편집하여 다음 줄을 추가한다.
254+
255+
```yaml
256+
- path: /v2
257+
pathType: Prefix
258+
backend:
259+
service:
260+
name: web2
261+
port:
262+
number: 8080
263+
```
264+
265+
1. 변경 사항을 적용한다.
266+
267+
```shell
268+
kubectl apply -f example-ingress.yaml
269+
```
270+
271+
Output:
272+
273+
```shell
274+
ingress.networking/example-ingress configured
275+
```
276+
277+
## 인그레스 테스트하기
278+
279+
1. Hello World 앱의 첫 번째 버전에 액세스한다.
280+
281+
```shell
282+
curl hello-world.info
283+
```
284+
285+
Output:
286+
287+
```shell
288+
Hello, world!
289+
Version: 1.0.0
290+
Hostname: web-55b8c6998d-8k564
291+
```
292+
293+
1. Hello World 앱의 두 번째 버전에 액세스한다.
294+
295+
```shell
296+
curl hello-world.info/v2
297+
```
298+
299+
Output:
300+
301+
```shell
302+
Hello, world!
303+
Version: 2.0.0
304+
Hostname: web2-75cd47646f-t8cjk
305+
```
306+
307+
{{< note >}}Minikube를 로컬에서 실행하는 경우 브라우저에서 hello-world.info 및 hello-world.info/v2에 접속할 수 있다.{{< /note >}}
308+
309+
310+
311+
312+
## {{% heading "whatsnext" %}}
313+
314+
* [인그레스](/ko/docs/concepts/services-networking/ingress/)에 대해 더 보기.
315+
* [인그레스 컨트롤러](/ko/docs/concepts/services-networking/ingress-controllers/)에 대해 더 보기.
316+
* [서비스](/ko/docs/concepts/services-networking/service/)에 대해 더 보기.
317+
318+
319+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: example-ingress
5+
annotations:
6+
nginx.ingress.kubernetes.io/rewrite-target: /$1
7+
spec:
8+
rules:
9+
- host: hello-world.info
10+
http:
11+
paths:
12+
- path: /
13+
pathType: Prefix
14+
backend:
15+
service:
16+
name: web
17+
port:
18+
number: 8080

0 commit comments

Comments
 (0)