Skip to content

Commit

Permalink
Add Kubernetes resources for webserver2 including Deployment, Service…
Browse files Browse the repository at this point in the history
…, Ingress, Namespace, and ClusterIssuer
  • Loading branch information
EliasDeHondt committed Dec 21, 2024
1 parent beb6823 commit 6fb5cd6
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Supercluster/Cluster01/WebServer2/ClusterIssuer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
namespace: webserver2
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: elias.dehondt@outlook.com
privateKeySecretRef:
name: letsencrypt-prod-key
solvers:
- http01:
ingress:
class: nginx
---
48 changes: 48 additions & 0 deletions Supercluster/Cluster01/WebServer2/Deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: webserver2-deployment
namespace: webserver2
spec:
replicas: 3
selector:
matchLabels:
app: webserver2
template:
metadata:
labels:
app: webserver2
spec:
initContainers:
- name: init-git-clone
image: alpine/git
command: ["sh", "-c", "git clone --depth=1 https://github.com/EliasDH-com/Zizis.com.git /app"]
volumeMounts:
- name: webserver2-volume
mountPath: /app
containers:
- name: webserver2-container
image: python:3.9-slim
command: ["python3", "-m", "http.server", "8080", "--directory", "/app", "--bind", "0.0.0.0"]
ports:
- containerPort: 8080
resources:
limits:
memory: "128Mi"
cpu: "500m"
requests:
memory: "64Mi"
cpu: "250m"
volumeMounts:
- name: webserver2-volume
mountPath: /app
volumes:
- name: webserver2-volume
emptyDir: {}
---
47 changes: 47 additions & 0 deletions Supercluster/Cluster01/WebServer2/Ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
namespace: webserver2
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
nginx.ingress.kubernetes.io/ssl-redirect: "true" # Redirect HTTP to HTTPS
spec:
ingressClassName: nginx
tls:
- hosts:
- zizis.com
secretName: zizis-tls
- hosts:
- www.zizis.com
secretName: wwwzizis-tls
rules:
- host: zizis.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: webserver2-service
port:
number: 80
- host: www.zizis.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: webserver2-service
port:
number: 80
---
19 changes: 19 additions & 0 deletions Supercluster/Cluster01/WebServer2/Namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: v1
kind: Namespace
metadata:
name: webserver2
labels:
name: webserver2
app: webserver2
owner: Zizis
environment: production
annotations:
description: This namespace is used for the webserver2 application.
contact: info@eliasdh.com
---
19 changes: 19 additions & 0 deletions Supercluster/Cluster01/WebServer2/Service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
############################
# @author Elias De Hondt #
# @see https://eliasdh.com #
# @since 24/11/2024 #
############################
---
apiVersion: v1
kind: Service
metadata:
name: webserver2-service
namespace: webserver2
spec:
selector:
app: webserver2
ports:
- protocol: TCP
port: 80
targetPort: 8080
---

0 comments on commit 6fb5cd6

Please sign in to comment.