Ingress example

This commit is contained in:
Jimmy 2022-02-08 23:55:21 +13:00
parent 8962d42a81
commit 82b4704f13
2 changed files with 37 additions and 0 deletions

11
ingress/README.md Normal file
View File

@ -0,0 +1,11 @@
https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/
```kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0```
```kubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0 --replicas=3```
```kubectl expose deployment web --type=NodePort --port=8080```
```kubectl expose deployment web2 --type=ClusterIP --port=8080```
```kubectl get service web```

26
ingress/ingress.yaml Normal file
View File

@ -0,0 +1,26 @@
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
- path: /v2
pathType: Prefix
backend:
service:
name: web2
port:
number: 8080