curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
helm install my-release oci://ghcr.io/nginxinc/charts/nginx-ingress --version 2.0.0
vagrant@slave1:~$ kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0
deployment.apps/web created
vagrant@slave1:~$ kubectl get deployment web
NAME READY UP-TO-DATE AVAILABLE AGE
web 1/1 1 1 25s
vagrant@slave1:~$ kubectl expose deployment web --type=NodePort --port=8080
service/web exposed
vagrant@slave1:~$ kubectl get service web
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
web NodePort 10.107.105.108 <none> 8080:31270/TCP 14s
vagrant@slave1:~$ curl http://192.168.56.10:31270
Hello, world!
Version: 1.0.0
Hostname: web-57f46db77f-dww5x
vagrant@slave1:~$ vi ing.yml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
spec:
ingressClassName: nginx
rules:
- host: hello-world.example
http:
paths:
- path: /hello
pathType: Prefix
backend:
service:
name: web
port:
number: 8080
vagrant@slave1:~$ k apply -f ing.yml
ingress.networking.k8s.io/example-ingress created
vagrant@slave1:~$ kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
example-ingress nginx hello-world.example 80 44s
C:\Windows\System32\drivers\etc\hosts 파일 수정
192.168.56.10 hello-world.example
vagrant@slave1:~$ curl hello-world.example:31270
Hello, world!
Version: 1.0.0
Hostname: web-57f46db77f-dww5x
브라우저 확인

vagrant@slave1:~$ curl --resolve "hello-world.example:31270:192.168.56.101" -i http://hello-world.example:31270/hello
HTTP/1.1 200 OK
Date: Thu, 19 Dec 2024 12:00:01 GMT
Content-Length: 60
Content-Type: text/plain; charset=utf-8
Hello, world!
Version: 1.0.0
Hostname: web-57f46db77f-dww5x