From 1cd21b939b657ee4574c53f4bc1de63aa2c12819 Mon Sep 17 00:00:00 2001 From: marcel-dempers Date: Sun, 20 Mar 2022 07:53:10 +1100 Subject: [PATCH] wip --- kubernetes/readme.md | 90 ------------------ kubernetes/tutorials/basics/README.md | 92 +++++++++++++++++++ .../basics/yaml}/deploy.yaml | 0 .../basics/yaml}/ingress.yaml | 0 .../basics/yaml}/service.yaml | 0 .../basics/yaml}/statefulset.yaml | 0 6 files changed, 92 insertions(+), 90 deletions(-) create mode 100644 kubernetes/tutorials/basics/README.md rename kubernetes/{tutorial => tutorials/basics/yaml}/deploy.yaml (100%) rename kubernetes/{tutorial => tutorials/basics/yaml}/ingress.yaml (100%) rename kubernetes/{tutorial => tutorials/basics/yaml}/service.yaml (100%) rename kubernetes/{tutorial => tutorials/basics/yaml}/statefulset.yaml (100%) diff --git a/kubernetes/readme.md b/kubernetes/readme.md index 28d8735..6f2a68e 100644 --- a/kubernetes/readme.md +++ b/kubernetes/readme.md @@ -1,95 +1,5 @@ # Learn Kubernetes YouTube :hammer::wrench: -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](https://docs.docker.com/get-docker/) - -## Run Kubernetes - -* Install `kubectl` to work with kubernetes - -We'll head over to the [kubernetes](https://kubernetes.io/docs/tasks/tools/) site to download `kubectl` - -* Install the `kind` binary - -You will want to head over to the [kind](https://kind.sigs.k8s.io/) site - -* Create a cluster - -``` -kind create cluster -``` - -## Namespaces - -``` -kubectl create namespace cms -``` - -## Deployments - -* Deployment [documentation](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) - -cd kubernetes\tutorial - -``` -kubectl -n cms apply -f deploy.yaml -kubectl -n cms get pods - -kubectl -n cms port-forward 80 -``` - -[Environment Variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) 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](https://kubernetes.io/docs/concepts/configuration/secret/) 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](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) - -# Storage Class - -StorageClass [documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/) - -# Services - -Services [documentation](https://kubernetes.io/docs/concepts/services-networking/service/) - -Let's deploy our `mysql` using what we learnt above: - -``` -kubectl -n cms apply -f .\statefulset.yaml -``` - ## Full playlist Kubernetes Guide diff --git a/kubernetes/tutorials/basics/README.md b/kubernetes/tutorials/basics/README.md new file mode 100644 index 0000000..e943d50 --- /dev/null +++ b/kubernetes/tutorials/basics/README.md @@ -0,0 +1,92 @@ +# Tutorial: The Basics + +This guide is aimed to fast-track your Kubernetes learning by focusing on a practical hands-on overview guide.
+ +
+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](https://docs.docker.com/get-docker/) + +## Run Kubernetes + +* Install `kubectl` to work with kubernetes + +We'll head over to the [kubernetes](https://kubernetes.io/docs/tasks/tools/) site to download `kubectl` + +* Install the `kind` binary + +You will want to head over to the [kind](https://kind.sigs.k8s.io/) site + +* Create a cluster + +``` +kind create cluster +``` + +## Namespaces + +``` +kubectl create namespace cms +``` + +## Deployments + +* Deployment [documentation](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) + +cd kubernetes\tutorial + +``` +kubectl -n cms apply -f deploy.yaml +kubectl -n cms get pods + +kubectl -n cms port-forward 80 +``` + +[Environment Variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) 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](https://kubernetes.io/docs/concepts/configuration/secret/) 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](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) + +# Storage Class + +StorageClass [documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/) + +# Services + +Services [documentation](https://kubernetes.io/docs/concepts/services-networking/service/) + +Let's deploy our `mysql` using what we learnt above: + +``` +kubectl -n cms apply -f .\statefulset.yaml +``` diff --git a/kubernetes/tutorial/deploy.yaml b/kubernetes/tutorials/basics/yaml/deploy.yaml similarity index 100% rename from kubernetes/tutorial/deploy.yaml rename to kubernetes/tutorials/basics/yaml/deploy.yaml diff --git a/kubernetes/tutorial/ingress.yaml b/kubernetes/tutorials/basics/yaml/ingress.yaml similarity index 100% rename from kubernetes/tutorial/ingress.yaml rename to kubernetes/tutorials/basics/yaml/ingress.yaml diff --git a/kubernetes/tutorial/service.yaml b/kubernetes/tutorials/basics/yaml/service.yaml similarity index 100% rename from kubernetes/tutorial/service.yaml rename to kubernetes/tutorials/basics/yaml/service.yaml diff --git a/kubernetes/tutorial/statefulset.yaml b/kubernetes/tutorials/basics/yaml/statefulset.yaml similarity index 100% rename from kubernetes/tutorial/statefulset.yaml rename to kubernetes/tutorials/basics/yaml/statefulset.yaml