minikube ingress nginx controller 설치

2024. 1. 28. 23:38k8s

https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

 

Set up Ingress on Minikube with the NGINX Ingress Controller

An Ingress is an API object that defines rules which allow external access to services in a cluster. An Ingress controller fulfills the rules set in the Ingress. This page shows you how to set up a simple Ingress which routes requests to Service 'web' or '

kubernetes.io

# ingress 설치
minikube addons enable ingress
kubectl get pods -n ingress-nginx

# hello, world app 배포
kuectl create deployment web --image=gcr.io/google-samples/hello-app:1.0
kubectl expose deployment web --type=NodePort --port=8080
kubectl get service web
minikube service web --url
curl {web 서비스 url}

# ingress 생성
vi example-ingress.yaml
------------------------------------------
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - host: hello-world.info
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web
                port:
                  number: 8080
------------------------------------------
kubectl apply -f ./example-ingress.yaml
kubectl get ingress
curl --resolve "hello-world.info:80:$(minikube ip)" -i {ingress HOSTS}

# hosts 등록
---------------------------------------
{minikube ip 정보} hello-world.info
---------------------------------------

'k8s' 카테고리의 다른 글

pod의 상태가 ContainerCreating일 때 조치  (0) 2024.02.03
minikube deployment yaml 파일 생성  (0) 2024.02.03
minikube 권한  (0) 2023.05.29
minikube subnet 변경  (0) 2023.04.30
minikube 설정 테스트  (0) 2023.04.08