mysql: First working kustomize
This commit is contained in:
parent
fa945f2e5c
commit
244458738c
10 changed files with 125 additions and 2 deletions
|
@ -3,3 +3,5 @@
|
|||
resources:
|
||||
- mysql_statefulset.yaml
|
||||
- mysql_service.yaml
|
||||
- phpmyadmin_deployment.yaml
|
||||
- phpmyadmin_service.yaml
|
||||
|
|
|
@ -4,6 +4,8 @@ metadata:
|
|||
name: db-service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
service: db
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3306
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: db-deployment
|
||||
name: db-statefulset
|
||||
labels:
|
||||
service: db
|
||||
spec:
|
||||
serviceName: db-service
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
service: db
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
service: db
|
||||
spec:
|
||||
containers:
|
||||
- name: mysql
|
||||
image: mysql:9
|
||||
image: mysql
|
||||
resources:
|
||||
requests:
|
||||
memory: "512Mi"
|
||||
|
|
38
mysql/kustomize/base/phpmyadmin_deployment.yaml
Normal file
38
mysql/kustomize/base/phpmyadmin_deployment.yaml
Normal file
|
@ -0,0 +1,38 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: phpmyadmin-deployment
|
||||
labels:
|
||||
service: phpmyadmin
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
service: phpmyadmin
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
service: phpmyadmin
|
||||
spec:
|
||||
containers:
|
||||
- name: phpmyadmin
|
||||
image: phpmyadmin
|
||||
resources:
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "1000m"
|
||||
ports:
|
||||
- containerPort: 80
|
||||
env:
|
||||
- name: PMA_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: mysql-configmap
|
||||
key: mysql-server
|
||||
- name: PMA_USER
|
||||
value: root
|
||||
- name: PMA_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mysql-secret
|
||||
key: mysql-root-password
|
12
mysql/kustomize/base/phpmyadmin_service.yaml
Normal file
12
mysql/kustomize/base/phpmyadmin_service.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: phpmyadmin-service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
service: phpmyadmin
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
34
mysql/kustomize/overlays/default/kustomization.yaml
Normal file
34
mysql/kustomize/overlays/default/kustomization.yaml
Normal file
|
@ -0,0 +1,34 @@
|
|||
resources:
|
||||
- ../../base
|
||||
- phpmyadmin_ingress.yaml
|
||||
|
||||
namespace: default
|
||||
|
||||
labels:
|
||||
- includeSelectors: true
|
||||
pairs:
|
||||
app: mysql
|
||||
|
||||
commonAnnotations:
|
||||
owner: florian
|
||||
|
||||
namePrefix: mysql-
|
||||
|
||||
images:
|
||||
- name: mysql
|
||||
newName: mysql
|
||||
newTag: "9"
|
||||
- name: phpmyadmin
|
||||
newName: phpmyadmin
|
||||
newTag: "5.2"
|
||||
|
||||
patches:
|
||||
- path: replica.yaml
|
||||
|
||||
configMapGenerator:
|
||||
- name: mysql-configmap
|
||||
env: mysql-configmap.properties
|
||||
|
||||
secretGenerator:
|
||||
- name: mysql-secret
|
||||
env: mysql-secret.properties
|
|
@ -0,0 +1 @@
|
|||
mysql-server=mysql-db-service
|
3
mysql/kustomize/overlays/default/mysql-secret.properties
Normal file
3
mysql/kustomize/overlays/default/mysql-secret.properties
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Encoded base64 string required by kubernetes
|
||||
# echo -n '<wanted_value>' | base64
|
||||
mysql-root-password="cm9vdA=="
|
18
mysql/kustomize/overlays/default/phpmyadmin_ingress.yaml
Normal file
18
mysql/kustomize/overlays/default/phpmyadmin_ingress.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: phpmyadmin-ingress
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: phpmyadmin-service
|
||||
port:
|
||||
number: 80
|
6
mysql/kustomize/overlays/default/replica.yaml
Normal file
6
mysql/kustomize/overlays/default/replica.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: phpmyadmin-deployment
|
||||
spec:
|
||||
replicas: 2
|
Loading…
Add table
Reference in a new issue