1. 개요
GKE에 Ingress를 생성한다.
2. 샘플 애플리케이션 배포
* web-deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: web
namespace: default
spec:
selector:
matchLabels:
run: web
template:
metadata:
labels:
run: web
spec:
containers:
- image: gcr.io/google-samples/hello-app:1.0
imagePullPolicy: IfNotPresent
name: web
ports:
- containerPort: 8080
protocol: TCP
* web-service.yaml
apiVersion: v1
kind: Service
metadata:
name: web
namespace: default
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
run: web
type: NodePort
kubectl apply -f web-deployment.yaml kubectl apply -f web-service.yaml
3. Ingress 생성
* basic-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: basic-ingress
spec:
backend:
serviceName: web
servicePort: 8080
basic-ingress.yaml를 배포한다.
kubectl apply -f basic-ingress.yaml
다음과 같이 Ingress를 확인한다.
kubectl get ingress basic-ingress
