How To Launch WordPress In Kubernetes Multi-Node Cluster

File for makind secrets
apiVersion: v1
kind: Secret
metadata:
name: "name you want to give to your secret"
type: Opaque
data:
"key": "value encode in base 64"
Eg:-
apiVersion: v1
kind: Secret
metadata:
name: secret-demo
type: Opaque
data:
password: UmVkaGF0
kubectl create -f filenameEg:-kubectl create -f secret.yml
#making service for mysql
apiVersion: v1
kind: Service
metadata:
name: [service name]
labels:
[key]: [value]
spec:
ports:
— port: 3306
selector:
[key]: [value]
clusterIP: None
# here we have set cluster ip to none to make headles service so that cluster ip service get adress of mysql pod and only internal pod can connect to it
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: [PVC name]
labels:
key: value
spec:
accessModes:
— ReadWriteOnce
resources:
requests:
storage: [size]
— -
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: [deployment name]
labels:
key: value
spec:
selector:
matchLabels:
key: value
strategy:
type: Recreate
template:
metadata:
labels:
key: value
spec:
containers:
— image: mysql:5.6
name: [pod name]
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: [secret name]
key: [secret key]
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: [volume name]
mountPath: /var/lib/mysql
volumes:
- name: [volume name]
persistentVolumeClaim:
claimName: [pvc name]
kubectl create -f filename
kubectl get service

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store