From 82b4704f13e4bd872d14009edead2ec30c15433c Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 8 Feb 2022 23:55:21 +1300 Subject: [PATCH] Ingress example --- ingress/README.md | 11 +++++++++++ ingress/ingress.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 ingress/README.md create mode 100644 ingress/ingress.yaml diff --git a/ingress/README.md b/ingress/README.md new file mode 100644 index 0000000..7fa4022 --- /dev/null +++ b/ingress/README.md @@ -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``` diff --git a/ingress/ingress.yaml b/ingress/ingress.yaml new file mode 100644 index 0000000..dcd8d55 --- /dev/null +++ b/ingress/ingress.yaml @@ -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 \ No newline at end of file