From 17622dc610050d4ce6a5f0ff6867ce21b1248404 Mon Sep 17 00:00:00 2001 From: MDanarKahfi Date: Mon, 26 Feb 2024 12:37:12 +0700 Subject: [PATCH] add: k8s, dockerfile --- .dockerignore | 2 ++ Dockerfile | 5 +++++ k8s/production/deployment.yaml | 22 ++++++++++++++++++++++ k8s/production/ingress.yaml | 25 +++++++++++++++++++++++++ k8s/production/middleware.yaml | 9 +++++++++ k8s/production/namespace.yaml | 4 ++++ k8s/production/service.yaml | 13 +++++++++++++ 7 files changed, 80 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 k8s/production/deployment.yaml create mode 100644 k8s/production/ingress.yaml create mode 100644 k8s/production/middleware.yaml create mode 100644 k8s/production/namespace.yaml create mode 100644 k8s/production/service.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..34064d7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git/ +k8s/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5a6b62f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx:alpine + +COPY . /usr/share/nginx/html/ + +EXPOSE 80 \ No newline at end of file diff --git a/k8s/production/deployment.yaml b/k8s/production/deployment.yaml new file mode 100644 index 0000000..d032c11 --- /dev/null +++ b/k8s/production/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bka-web + namespace: empatnusabangsa-production +spec: + selector: + matchLabels: + app: bka-web + replicas: 1 + template: + metadata: + labels: + app: bka-web + spec: + containers: + - name: bka-web + image: registry-harbor.app.bangun-kreatif.com/empatnusabangsa/bka-web: + ports: + - containerPort: 80 + imagePullSecrets: + - name: regcred diff --git a/k8s/production/ingress.yaml b/k8s/production/ingress.yaml new file mode 100644 index 0000000..4684c32 --- /dev/null +++ b/k8s/production/ingress.yaml @@ -0,0 +1,25 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: bka-web-ingress + namespace: empatnusabangsa-production + annotations: + kubernetes.io/ingress.class: "traefik" + cert-manager.io/cluster-issuer: letsencrypt-prod + traefik.ingress.kubernetes.io/router.middlewares: empatnusabangsa-production-redirect-https@kubernetescrd +spec: + rules: + - host: "www.bangun-kreatif.com" + http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: bka-web + port: + number: 80 + tls: + - hosts: + - "www.bangun-kreatif.com" + secretName: www-bangun-kreatif-com-tls diff --git a/k8s/production/middleware.yaml b/k8s/production/middleware.yaml new file mode 100644 index 0000000..ec686d7 --- /dev/null +++ b/k8s/production/middleware.yaml @@ -0,0 +1,9 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: redirect-https + namespace: empatnusabangsa-production +spec: + redirectScheme: + scheme: https + permanent: true diff --git a/k8s/production/namespace.yaml b/k8s/production/namespace.yaml new file mode 100644 index 0000000..823e09a --- /dev/null +++ b/k8s/production/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: empatnusabangsa-production diff --git a/k8s/production/service.yaml b/k8s/production/service.yaml new file mode 100644 index 0000000..f46751c --- /dev/null +++ b/k8s/production/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: bka-web + namespace: empatnusabangsa-production + labels: + run: bka-web +spec: + ports: + - port: 80 + protocol: TCP + selector: + app: bka-web