5.2 KiB
Learn Kubernetes
🔨🔧
This guide is aimed to fast-track your Kubernetes learning by focusing on a practical hands-on overview guide.
This means, not too much of a deepdive, but enough to get a feel for the required building blocks of Kubernetes so you can align it with a real world problem that you are trying to solve.
The problem: "I want to adopt Kubernetes"
The problem: "I have some common existing infrastructure"
Our focus: Solving the problem by learning each building block in order to port our infrastructure to Kubernetes.
Docker installation
- Install Docker here
Run Kubernetes
- Install
kubectl
to work with kubernetes
We'll head over to the kubernetes site to download kubectl
- Install the
kind
binary
You will want to head over to the kind site
- Create a cluster
kind create cluster
Namespaces
kubectl create namespace cms
Deployments
- Deployment documentation
cd kubernetes\tutorial
kubectl -n cms apply -f deploy.yaml
kubectl -n cms get pods
kubectl -n cms port-forward <pod-name> 80
Environment Variables for pods
Secrets
kubectl -n cms create secret generic wordpress `
--from-literal WORDPRESS_DB_HOST=mysql `
--from-literal WORDPRESS_DB_USER=exampleuser `
--from-literal WORDPRESS_DB_PASSWORD=examplepassword `
--from-literal WORDPRESS_DB_NAME=exampledb
kubectl -n cms get secret
How to use secrets in pods
Apply changes to our deployment
kubectl -n cms apply -f deploy.yaml
We can port-forward
again, and notice an error connecting to the database because the database does not exist
Statefulset
Statefulset documentation
Storage Class
StorageClass documentation
Services
Services documentation
Let's deploy our mysql
using what we learnt above:
kubectl -n cms apply -f .\statefulset.yaml
Full playlist
Getting Started with Kubernetes on Windows for beginners
Kubectl
Checkout kubectl for detailed steps
Deployments
Checkout deployments for detailed steps