initial
This commit is contained in:
22
deploy.sh
Executable file
22
deploy.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
NAMESPACE=cacti
|
||||
|
||||
kubectl create namespace $NAMESPACE \
|
||||
--dry-run=client \
|
||||
-o yaml | \
|
||||
kubectl -f - apply
|
||||
|
||||
kubectl create secret generic mariadb-secrets \
|
||||
--dry-run=client \
|
||||
-o yaml \
|
||||
--save-config \
|
||||
--from-literal=MARIADB_USER=cacti \
|
||||
--from-literal=MARIADB_DATABASE=cacti \
|
||||
--from-literal=MARIADB_PASSWORD=test123 \
|
||||
--from-literal=MARIADB_ROOT_PASSWORD=test1234 | \
|
||||
kubectl apply -n $NAMESPACE -f -
|
||||
|
||||
|
||||
kubectl apply -f mariadb.yml -n $NAMESPACE
|
||||
|
||||
67
mariadb.yml
Normal file
67
mariadb.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: mariadb-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: nfs-client
|
||||
resources:
|
||||
requests:
|
||||
storage: 500Mi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mariadb
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mariadb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mariadb
|
||||
spec:
|
||||
containers:
|
||||
- name: mariadb
|
||||
image: mariadb:10.2
|
||||
ports:
|
||||
- name: mariadb
|
||||
containerPort: 3306
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 3306
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
volumeMounts:
|
||||
- name: mariadb-data
|
||||
mountPath: /var/lib/mysql
|
||||
readOnly: true
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: mariadb-secrets
|
||||
volumes:
|
||||
- name: mariadb-data
|
||||
persistentVolumeClaim:
|
||||
claimName: mariadb-data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mariadb
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: mariadb
|
||||
ports:
|
||||
- name: mariadb
|
||||
port: 3306
|
||||
targetPort: 3306
|
||||
protocol: TCP
|
||||
|
||||
Reference in New Issue
Block a user