Minikube: Install PVC MySQL dan Wordpress

From OnnoWiki
Jump to navigation Jump to search

Sumber: https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/


Objectif

  • Create PersistentVolumeClaims and PersistentVolumes
  • Create a kustomization.yaml with
    • a Secret generator
    • MySQL resource configs
    • WordPress resource configs
  • Apply the kustomization directory by kubectl apply -k ./
  • Clean up


Download

cd ~
mkdir TEST
wget https://kubernetes.io/examples/application/wordpress/mysql-deployment.yaml
wget https://kubernetes.io/examples/application/wordpress/wordpress-deployment.yaml


Kustomization.yaml

Buat password

cd ~/TEST
vi kustomization.yaml
secretGenerator:
- name: mysql-pass
  literals:
  - password=123456


Download MySQL deployment configuration file

cd ~/TEST
curl -LO https://k8s.io/examples/application/wordpress/mysql-deployment.yaml

Download WordPress configuration file

cd ~/TEST
curl -LO https://k8s.io/examples/application/wordpress/wordpress-deployment.yaml


Tambahkan ke kustomization.yaml

resources:
  - mysql-deployment.yaml
  - wordpress-deployment.yaml


Apply & Verify

cd ~/TEST
kubectl apply -k ./


Verify Secret

kubectl get secrets

Verify PresistenceVolume

kubectl get pvc

Verify pods

kubectl get pods

Cek Service

kubectl get services wordpress
minikube service wordpress --url


Buka URL di Browser



Referensi