From 72b104120ba193030f94a4ec81dc52068d6a4a6c Mon Sep 17 00:00:00 2001 From: Abhishek Rana Date: Sat, 23 Sep 2023 13:01:10 +0200 Subject: [PATCH] Update code --- k8s/templates/hello-world/deployment.yaml | 31 +++++++++++++++++++++++ k8s/templates/hello-world/service.yaml | 18 +++++++++++++ k8s/templates/nginx/deployment.yaml | 22 ++++++++++++++++ k8s/templates/nginx/service.yaml | 17 +++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 k8s/templates/hello-world/deployment.yaml create mode 100644 k8s/templates/hello-world/service.yaml create mode 100644 k8s/templates/nginx/deployment.yaml create mode 100644 k8s/templates/nginx/service.yaml diff --git a/k8s/templates/hello-world/deployment.yaml b/k8s/templates/hello-world/deployment.yaml new file mode 100644 index 0000000..1163ee0 --- /dev/null +++ b/k8s/templates/hello-world/deployment.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: hello-world-deployment + labels: + app: hello-world + app.kubernetes.io/name: hello-world + app.kubernetes.io/instance: tech-stack + app.kubernetes.io/version: '0.1.0' +spec: + replicas: 1 + selector: + matchLabels: + app: hello-world + app.kubernetes.io/name: hello-world + app.kubernetes.io/instance: tech-stack + template: + metadata: + labels: + app: hello-world + app.kubernetes.io/name: hello-world + app.kubernetes.io/instance: tech-stack + spec: + containers: + - name: hello-world + image: abhishekrana502/hello-world:latest + imagePullPolicy: Always + ports: + - name: http + containerPort: 80 + protocol: TCP diff --git a/k8s/templates/hello-world/service.yaml b/k8s/templates/hello-world/service.yaml new file mode 100644 index 0000000..ce3b4b6 --- /dev/null +++ b/k8s/templates/hello-world/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: hello-world-service + labels: + app.kubernetes.io/name: hello-world + app.kubernetes.io/instance: tech-stack + app.kubernetes.io/version: '0.1.0' +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: hello-world + app.kubernetes.io/instance: tech-stack diff --git a/k8s/templates/nginx/deployment.yaml b/k8s/templates/nginx/deployment.yaml new file mode 100644 index 0000000..f0237b1 --- /dev/null +++ b/k8s/templates/nginx/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 1 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + # image: abhishekrana502/hello-world:latest + ports: + - containerPort: 80 diff --git a/k8s/templates/nginx/service.yaml b/k8s/templates/nginx/service.yaml new file mode 100644 index 0000000..0b7164a --- /dev/null +++ b/k8s/templates/nginx/service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-service +spec: + ports: + - port: 80 # the port that this service should serve on + # the container on each pod to connect to, can be a name + # (e.g. 'www') or a number (e.g. 80) + targetPort: 80 + protocol: TCP + # just like the selector in the deployment, + # but this time it identifies the set of pods to load balance + # traffic to. + selector: + app: nginx + # type: LoadBalancer