Helm Hands On
WordPress Setup
Workflow for Helm
-
Create Kubernetes Definition Files
- Set up WordPress using Kubernetes objects:
- Deployment
- Service
- Persistent Volume Claim (PVC)
- Ingress
- Secret
- Set up WordPress using Kubernetes objects:
-
Convert to Helm
- Use AI tools to develop Helm charts efficiently.
- Amazon Q (Generative AI)
- Use AI tools to develop Helm charts efficiently.
-
Deploy and Manage
- Deploy the chart:
helm install <release-name> <chart-path>
- Upgrade the chart:
helm upgrade <release-name> <chart-name> -f values.yaml
- Uninstall the chart:
helm uninstall <release-name>
- List releases:
helm list
- Deploy the chart:
-
More Options in Helm
- Use Code Assistant to implement Dev Best practices.
Demo
Have a kubernetes cluster installed on your AWS EC 2 instance
kubectl get nodes
# NAME STATUS ROLE
# i-dg3 Ready node
# i-gha Ready control-plane
# i-7df Ready node
setup ingress controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.2/deploy/static/provider/aws/deploy.yaml
Display and copy entire cubeconfig file:
create a kubeconfig file on your PC
Create a Worpress App & MySQL DB in Helm
How?
-
Open a browser, find the definition files, copy paste and make changes.
- In google, search for
wordpress kubernetes definitions
- You should find a page like
Deploying WordPress and MySQL with Persistent Volumes
- Teke this resources and create files, change settings and run it
- In google, search for
-
Ask AmazonQ AI to create it for us.
- Install and Setup AmazonQ from VSC Extensions
- Use the prompt to create the resources/files
- AmazonQ is currently the most accurate AI for Kubernetes
Build with AmazonQ
Make sure we have Nginx ingress controller:
kubectl get ns # NameSpaces
# NAME STATUS AGE
# default Active 46m
# ingress-nginx Active 21m <---
# kube-node-lease Active 46m
# kube-public Active 46m
# kube-system Active 46m
Check storage class:
# OUTPUT
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
default kubernetes.io/aws-ebs Delete Immediate false 47m
gp2 kubernetes.io/aws-ebs Delete Immediate false 47m
kops-csi-1-21 (default) ebs.csi.aws.com Delete WaitForFirstConsumer true 47m
kops-ssd-1-17 kubernetes.io/aws-ebs Delete WaitForFirstConsumer true 47m
As you see we have EBS type volume that was created by 'Kops' for AWS.
So we need to mention this EBS volume type as 'Storage Class'.
Make sure to have all the information before writing the prompt.
AmazonQ Prompt Demo
Open a new foulder with VSC.
Prompt AmazonQ this text and wait for AI to build the files.
Wordpress setup kubernetes definitions files. Separate files for wordpress app, mysql (needs to be version 8.0), app service, db service, PVC, secret and ingress. PVC should use storage class default, secret file should contain all the db users and db passwords for mysql and wordpress both. Ingress will be nginx with hostname wordpress.alexanderlindholm.net.
7 files should be created:
.
├── mysql-deployment.yaml
├── mysql-pvc.yaml
├── mysql-service.yaml
├── wordpress-deployment.yaml
├── wordpress-ingress.yaml
├── wordpress-pvc.yaml
├── wordpress-secret.yaml
├── wordpress-service.yaml
1 directory, 7 files
Install Helm
Create Helm chart
Additional example/template files should be created in wp-chart directory:
.
├── mysql-deployment.yaml
├── mysql-pvc.yaml
├── mysql-service.yaml
├── wordpress-deployment.yaml
├── wordpress-ingress.yaml
├── wordpress-pvc.yaml
├── wordpress-secret.yaml
├── wordpress-service.yaml
└── wp-chart
├── charts
├── Chart.yaml
├── templates
│ ├── deployment.yaml
│ ├── _helpers.tpl
│ ├── hpa.yaml
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── serviceaccount.yaml
│ ├── service.yaml
│ └── tests
│ └── test-connection.yaml
└── values.yaml
5 directories, 17 files
Delete all .yaml
files in templates directory:
Delete the wp-chart directory:
Clear all text in values.yaml
:
File structure should now look like this:
.
├── mysql-deployment.yaml
├── mysql-pvc.yaml
├── mysql-service.yaml
├── wordpress-deployment.yaml
├── wordpress-ingress.yaml
├── wordpress-pvc.yaml
├── wordpress-secret.yaml
├── wordpress-service.yaml
└── wp-chart
├── charts
├── Chart.yaml
├── templates
│ ├── _helpers.tpl
│ └── NOTES.txt
└── values.yaml
4 directories, 12 files
Copy ai created kubernetes definition files to templates directory:
File Structure should now look like:
.
├── mysql-deployment.yaml
├── mysql-pvc.yaml
├── mysql-service.yaml
├── wordpress-deployment.yaml
├── wordpress-ingress.yaml
├── wordpress-pvc.yaml
├── wordpress-secret.yaml
├── wordpress-service.yaml
└── wp-chart
├── charts
├── Chart.yaml
├── templates
│ ├── _helpers.tpl
│ ├── mysql-deployment.yaml
│ ├── mysql-pvc.yaml
│ ├── mysql-service.yaml
│ ├── NOTES.txt
│ ├── wordpress-deployment.yaml
│ ├── wordpress-ingress.yaml
│ ├── wordpress-pvc.yaml
│ ├── wordpress-secret.yaml
│ └── wordpress-service.yaml
└── values.yaml
4 directories, 20 files
in mysql-deployment.yaml
replace
to
replace
to
Add values in mysql-deployment.yaml
Then to deploy the app run