Skip to content

Commit ae4e993

Browse files
committed
Initial commit - all k8s deployment yaml
1 parent cf2f0c8 commit ae4e993

9 files changed

+528
-0
lines changed

.gitignore

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
files.txt
30+
31+
# PyInstaller
32+
# Usually these files are written by a python script from a template
33+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34+
*.manifest
35+
*.spec
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.nox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*.cover
51+
*.py,cover
52+
.hypothesis/
53+
.pytest_cache/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
.python-version
87+
88+
# pipenv
89+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
90+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
91+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
92+
# install all needed dependencies.
93+
#Pipfile.lock
94+
95+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
96+
__pypackages__/
97+
98+
# Celery stuff
99+
celerybeat-schedule
100+
celerybeat.pid
101+
102+
# SageMath parsed files
103+
*.sage.py
104+
105+
# Environments
106+
.env
107+
.venv
108+
env/
109+
venv/
110+
ENV/
111+
env.bak/
112+
venv.bak/
113+
114+
# Spyder project settings
115+
.spyderproject
116+
.spyproject
117+
118+
# Rope project settings
119+
.ropeproject
120+
121+
# mkdocs documentation
122+
/site
123+
124+
# mypy
125+
.mypy_cache/
126+
.dmypy.json
127+
dmypy.json
128+
129+
# Pyre type checker
130+
.pyre/
131+
132+
# vim
133+
*.swp
134+
*.swo
135+
136+
# snap
137+
*.snap
138+
139+
# pycharm
140+
.idea/

cluster-issuer-staging.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: ClusterIssuer
3+
metadata:
4+
name: letsencrypt-staging
5+
spec:
6+
acme:
7+
# The ACME server URL
8+
server: https://acme-staging-v02.api.letsencrypt.org/directory
9+
# Email address used for ACME registration
10+
11+
# Name of a secret used to store the ACME account private key
12+
privateKeySecretRef:
13+
name: letsencrypt-private-key
14+
# Enable the HTTP-01 challenge provider
15+
solvers:
16+
- http01:
17+
ingress:
18+
class: nginx

cluster-issuer.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: ClusterIssuer
3+
metadata:
4+
name: letsencrypt
5+
spec:
6+
acme:
7+
# The ACME server URL
8+
server: https://acme-v02.api.letsencrypt.org/directory
9+
# Email address used for ACME registration
10+
11+
# Name of a secret used to store the ACME account private key
12+
privateKeySecretRef:
13+
name: letsencrypt-private-key
14+
# Enable the HTTP-01 challenge provider
15+
solvers:
16+
- http01:
17+
ingress:
18+
class: nginx

hpa.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: autoscaling/v2beta2
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: wordpress
5+
spec:
6+
scaleTargetRef:
7+
apiVersion: apps/v1
8+
kind: Deployment
9+
name: wordpress
10+
minReplicas: 1
11+
maxReplicas: 2
12+
metrics:
13+
- type: Resource
14+
resource:
15+
name: cpu
16+
target:
17+
type: Utilization
18+
averageUtilization: 90
19+
- type: Resource
20+
resource:
21+
name: memory
22+
target:
23+
type: AverageValue
24+
averageValue: 300Mi
25+
---
26+
apiVersion: autoscaling/v2beta2
27+
kind: HorizontalPodAutoscaler
28+
metadata:
29+
name: ingress
30+
spec:
31+
scaleTargetRef:
32+
apiVersion: apps/v1
33+
kind: Deployment
34+
name: ingress-ingress-nginx-controller
35+
minReplicas: 1
36+
maxReplicas: 2
37+
metrics:
38+
- type: Resource
39+
resource:
40+
name: cpu
41+
target:
42+
type: Utilization
43+
averageUtilization: 50
44+
- type: Resource
45+
resource:
46+
name: memory
47+
target:
48+
type: AverageValue
49+
averageValue: 150Mi

ingress.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: foolcontrol
5+
annotations:
6+
kubernetes.io/tls-acme: "true"
7+
kubernetes.io/ingress.class: "nginx"
8+
nginx.ingress.kubernetes.io/proxy-body-size: 40m
9+
cert-manager.io/cluster-issuer: letsencrypt
10+
spec:
11+
tls:
12+
- hosts:
13+
- "foolcontrol.org"
14+
secretName: wordpress-tls
15+
rules:
16+
- host: "foolcontrol.org"
17+
http:
18+
paths:
19+
- pathType: Prefix
20+
path: "/"
21+
backend:
22+
service:
23+
name: wordpress
24+
port:
25+
name: wp-svc

kustomization.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
secretGenerator:
4+
- name: mysql-root-pass
5+
literals:
6+
- password=redacted
7+
- name: wp-db-host
8+
literals:
9+
- host=redacted
10+
- name: wp-db-user
11+
literals:
12+
- password=redacted
13+
- name: mysql-db-pass
14+
literals:
15+
- password=redacted
16+
- name: wp-db-name
17+
literals:
18+
- password=redacted
19+
resources:
20+
- nfs.yaml
21+
- vpa.yaml
22+
- wordpress-deployment.yaml
23+
- hpa.yaml
24+
- ingress.yaml

nfs.yaml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nfs-server
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
role: nfs-server
10+
template:
11+
metadata:
12+
labels:
13+
role: nfs-server
14+
spec:
15+
containers:
16+
- name: nfs-server
17+
image: docker.io/adnanhodzic/nfs-server-k8s:0.1
18+
ports:
19+
- name: nfs
20+
containerPort: 2049
21+
- name: mountd
22+
containerPort: 20048
23+
- name: rpcbind
24+
containerPort: 111
25+
securityContext:
26+
privileged: true
27+
resources:
28+
# ToDo: update properly
29+
limits:
30+
cpu: 250m
31+
memory: "300Mi"
32+
requests:
33+
memory: "150Mi"
34+
cpu: "100m"
35+
volumeMounts:
36+
- mountPath: /exports
37+
name: mypvc
38+
volumes:
39+
- name: mypvc
40+
gcePersistentDisk:
41+
pdName: wp-nfs-disk
42+
fsType: ext4
43+
---
44+
apiVersion: v1
45+
kind: Service
46+
metadata:
47+
name: nfs-server
48+
spec:
49+
ports:
50+
- name: nfs
51+
port: 2049
52+
- name: mountd
53+
port: 20048
54+
- name: rpcbind
55+
port: 111
56+
selector:
57+
role: nfs-server
58+
---
59+
apiVersion: v1
60+
kind: PersistentVolume
61+
metadata:
62+
name: nfs
63+
spec:
64+
capacity:
65+
storage: 10Gi
66+
accessModes:
67+
- ReadWriteMany
68+
nfs:
69+
server: nfs-server.default.svc.cluster.local
70+
path: "/"
71+
72+
---
73+
kind: PersistentVolumeClaim
74+
apiVersion: v1
75+
metadata:
76+
name: nfs
77+
spec:
78+
accessModes:
79+
- ReadWriteMany
80+
storageClassName: ""
81+
resources:
82+
requests:
83+
storage: 10Gi

0 commit comments

Comments
 (0)