reorganization

This commit is contained in:
Christian Lempa
2022-05-19 15:06:21 +02:00
parent e90f8dea72
commit f153104f87
36 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: your-certificate
namespace: your-namespace
spec:
secretName: your-secret
issuerRef:
name: ssl-issuer
kind: ClusterIssuer
dnsNames:
- your-hostname

View File

@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:5.6
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: root-pass
ports:
- name: mysql
containerPort: 3306
# volumeMounts:
# - name: mysql-vol
# mountPath: /var/lib/mysql
# volumes:
# - name: mysql-vol
# hostPath:
# path: /var/mysql-data

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: mysql-secret
type: Opaque
stringData:
root-pass: test123

View File

@@ -0,0 +1,28 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-http-cm
data:
# key: value
# file: |
# content
# ---
nginx.conf: |
user nginx;
worker_processes 1;
events {
worker_connections 10240;
}
http {
server {
listen 80;
server_name _;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /test {
return 401;
}
}
}

View File

@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-http
spec:
replicas: 1
selector:
matchLabels:
app: nginx-http
template:
metadata:
labels:
app: nginx-http
spec:
containers:
- name: nginx-http
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
- name: nginx-http-cm
mountPath: /etc/nginx
- name: nginx-http-vol
mountPath: /usr/share/nginx/html
volumes:
- name: nginx-http-cm
configMap:
name: nginx-http-cm
- name: nginx-http-vol
hostPath:
path: /var/nginxserver

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-http-svc
labels:
app: nginx-http
spec:
type: LoadBalancer
ports:
- port: 30080
targetPort: 80
protocol: TCP
name: http
selector:
app: nginx-http

View File

@@ -0,0 +1,27 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-https-cm
data:
nginx.conf: |
user nginx;
worker_processes 1;
events {
worker_connections 10240;
}
http {
server {
listen 80;
listen 443 ssl;
server_name _;
ssl_certificate /etc/nginx/ssl/server-cert.pem;
ssl_certificate_key /etc/nginx/ssl/server-key.pem;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
}

View File

@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-https
spec:
replicas: 1
selector:
matchLabels:
app: nginx-https
template:
metadata:
labels:
app: nginx-https
spec:
containers:
- name: nginx-https
image: nginx
ports:
- name: web
containerPort: 80
- name: secureweb
containerPort: 443
volumeMounts:
- name: nginx-https-cm
mountPath: /etc/nginx
- name: nginx-https-secret
mountPath: /etc/nginx/ssl
readOnly: true
- name: nginx-https-vol
mountPath: /usr/share/nginx/html
volumes:
- name: nginx-https-cm
configMap:
name: nginx-https-cm
- name: nginx-https-secret
secret:
secretName: nginx-https-secret
- name: nginx-https-vol
hostPath:
path: /var/nginxserver
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-https-cm
data:
nginx.conf: |
user nginx;
worker_processes 1;
events {
worker_connections 10240;
}
http {
server {
listen 80;
listen 443 ssl;
server_name _;
ssl_certificate /etc/nginx/ssl/server-cert.pem;
ssl_certificate_key /etc/nginx/ssl/server-key.pem;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
}

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: nginx-https-secret
type: Opaque
stringData:
server-cert.pem: |
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
server-key.pem: |

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-https-svc
labels:
app: nginx-https
spec:
type: LoadBalancer
ports:
- port: 31080
targetPort: 80
protocol: TCP
name: http
- port: 31443
targetPort: 443
protocol: TCP
name: https
selector:
app: nginx-https

View File

@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: appname # Name of the deployment
namespace: namespace # Name of the namespace
labels:
app: appname # Name of your application
spec:
selector:
matchLabels:
app: appname # Name of your application
replicas: 1 # Number of replicas
template:
metadata:
labels:
app: appname # Name of your application
spec:
containers:
# Containers are the individual pieces of your application that you want
# to run.
- name: helloworld # Name of the container
image: helloworld:latest # The image you want to run
# resources:
# limits:
# memory: 512Mi
# cpu: "1"
# requests:
# memory: 256Mi
# cpu: "0.2"
ports:
# Ports are the ports that your application uses.
- containerPort: 8080 # The port that your application uses
volumeMounts:
# VolumeMounts are the volumes that your application uses.
- mountPath: /var/www/html # The path that your application uses
name: vol0 # Name of the volume
volumes:
# Volumes are the persistent storage that your application uses.
- name: vol0 # Name of the volume
persistentVolumeClaim:
claimName: pvc0 # Name of the persistent volume claim

View File

@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress # Name of the ingress object
namespace: namespace # Name of the namespace
spec:
rules:
- host: "your-hostname.com" # Your hostname
http:
paths:
# Path-based routing settings:
- path: /
pathType: Prefix
backend:
service:
name: your-service-name # The name of the service
port:
number: 80 # Service Portnumber

View File

@@ -0,0 +1,29 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc0
namespace: namespace
labels:
app: namespace
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
# ---
# Digital Ocean
# storageClassName: do-block-storage
# ---
# AWS
# storageClassName: aws-ebs
# ---
# Azure
# storageClassName: azure-disk
# ---
# GCE PD
# storageClassName: gce-pd
# ---
# CIVO
# storageClassName: civo-volume
# ---

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: civo
spec:
accessModes:
- ReadWriteOnce
storageClassName: civo-volume
resources:
requests:
storage: 1Gi

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: civo-web
spec:
replicas: 1
selector:
matchLabels:
app: civo-web
template:
metadata:
labels:
app: civo-web
spec:
containers:
- name: civo-web
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
- name: civo
mountPath: /usr/share/nginx/html
volumes:
- name: civo
persistentVolumeClaim:
claimName: civo

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: local-web
spec:
replicas: 1
selector:
matchLabels:
app: local-web
template:
metadata:
labels:
app: local-web
spec:
containers:
- name: local-web
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
- name: local
mountPath: /usr/share/nginx/html
volumes:
- name: local
hostPath:
path: /var/nginxserver

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 500Mi
accessModes:
- ReadWriteMany
storageClassName: nfs
nfs:
server: 192.168.1.7
path: "/srv/nfs"

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs
spec:
accessModes:
- ReadWriteMany
storageClassName: nfs
resources:
requests:
storage: 100Mi

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nfs-web
spec:
replicas: 1
selector:
matchLabels:
app: nfs-web
template:
metadata:
labels:
app: nfs-web
spec:
containers:
- name: nfs-web
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
- name: nfs
mountPath: /usr/share/nginx/html
volumes:
- name: nfs
persistentVolumeClaim:
claimName: nfs

View File

@@ -0,0 +1,32 @@
apiVersion: v1
kind: Service
metadata:
name: servicename
namespace: namespace
spec:
selector:
app: appname
# ---
# type: ClusterIP
# ClusterIP means this service can be accessed by any pod in the cluster
# ports:
# - name: http
# port: 8080
# targetPort: 80
# protocol: TCP # optional protocol
# ---
# type: NodePort
# NodePort means this service is only accessible by pods in the same namespace
# ports:
# - name: http
# port: 80
# nodePort: 30001
# protocol: TCP # optional protocol
# ---
# type: LoadBalancer
# LoadBalancer means this service is load-balanced across all nodes in the cluster
# ports:
# - name: http
# port: 80
# targetPort: 30001
# protocol: TCP # optional protocol