728x90
반응형
SMALL
파일 생성
vim ingress02-deploy.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress-deploy-test02
spec:
replicas: 3
selector:
matchLabels:
app: web-deploy02
template:
metadata:
labels:
app: web-deploy02
spec:
containers:
- name: nginx
image: nginx:1.25
vim ingress02-service.yml
apiVersion: v1
kind: Service
metadata:
name: ingress-service-test02
spec:
selector:
app: web-deploy02
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 80
vim ingress02-ingress.yml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test02
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /test01
pathType: Prefix
backend:
service:
name: ingress-service-test01
port:
number: 80
- path: /test02
pathType: Prefix
backend:
service:
name: ingress-service-test02
port:
number: 80
인그레스 실행
kubectl apply -f ingress01-deploy.yml
kubectl apply -f ingress01-service.yml
kubectl apply -f ingress02-deploy.yml
kubectl apply -f ingress02-service.yml
kubectl apply -f ingress02-ingress.yml
kubectl get all
접속 확인
kubectl delete -f ingress02-ingress.yml
kubectl delete -f ingress02-service.yml
kubectl delete -f ingress02-deploy.yml
kubectl delete -f ingress01-service.yml
kubectl delete -f ingress01-deploy.yml
728x90
반응형
LIST
'App Programming > Kubernetes' 카테고리의 다른 글
[K8s] 크론잡 (CronJob) (0) | 2024.06.09 |
---|---|
[K8s] 잡 (Job) (0) | 2024.06.09 |
[K8s] nginx (0) | 2024.06.09 |
[K8s] 인그레스 (Ingress) (0) | 2024.06.09 |
[K8s] metalLB (0) | 2024.06.09 |