[doc] update the doc

This commit is contained in:
Sarah Franc 2022-10-12 12:10:44 +02:00
parent c87de40c6e
commit af5e223427
4 changed files with 73 additions and 58 deletions

View File

@ -1,5 +1,8 @@
--- ---
version: 2.1 version: 2.1
orbs:
yamllint: freighthub/yamllint@1.0.0
jobs: jobs:
lint-yml: lint-yml:
docker: docker:
@ -8,14 +11,14 @@ jobs:
- checkout - checkout
- run: - run:
name: install yamllint name: install yamllint
command: sudo pip install yamllint command: pip install --user yamllint
- run: - run:
name: lint yml name: lint yml
command: yamllint . command: /home/circleci/.local/bin/yamllint .
lint-md: lint-md:
docker: docker:
- image: circleci/node:12 - image: cimg/node:18.10.0
steps: steps:
- checkout - checkout
- run: - run:

View File

@ -1,3 +1,4 @@
---
extends: default extends: default
rules: rules:

View File

@ -74,7 +74,7 @@ Our first `pod` is now running. Now `describe` it. `describe` is a `get` on ster
$ kubectl describe pod simple-pod $ kubectl describe pod simple-pod
[a lot of stuff] [a lot of stuff]
IP: 172.17.0.1 IP: 172.17.0.4
[more stuff] [more stuff]
``` ```

119
README.md
View File

@ -1,29 +1,36 @@
# Kubernetes Hands on # Kubernetes Hands on
1. [Prerequisites](#prerequisites) - [Kubernetes Hands on](#kubernetes-hands-on)
1. [What it is not](#what-it-is-not) - [License](#license)
1. [What is Kubernetes? What is it used for?](#what-is-kubernetes-what-is-it-used-for) - [Prerequisites](#prerequisites)
1. [Glossary](#glossary) - [(Fixed) docker: Ingress not exposed on MacOS](#fixed-docker-ingress-not-exposed-on-macos)
1. [The base building block: pods](#the-base-building-block-pods) - [(Optional) If you feel adventurous, only for macOS](#optional-if-you-feel-adventurous-only-for-macos)
1. [Naming things: labels and annotations](#naming-things-labels-and-annotations) - [Completion](#completion)
1. [Deploying your first application: deployment](#deploying-my-first-application-deployment) - [What this course is and what it's not](#what-this-course-is-and-what-its-not)
1. [Accessing your first application: service](#accessing-my-first-application-service) - [What this is](#what-this-is)
1. [Running a background process: cronjobs](#running-a-background-process-cronjobs) - [What it's *not*](#what-its-not)
1. [Secrets](#secrets) - [What is Kubernetes? What is it used for](#what-is-kubernetes-what-is-it-used-for)
1. [Liveness and readiness probes, and how it impacts your pods](#liveness-and-readiness-probes,-and-how-it-impacts-your-pods) - [Glossary](#glossary)
1. [Resources, and how it impacts the scheduling](#resources,-and-how-it-impacts-the-scheduling) - [The base building block: pods](#the-base-building-block-pods)
1. [Improving the availability of your application: affinity and anti-affinity](#affinity-and-anti-affinity) - [Naming things: labels and annotations](#naming-things-labels-and-annotations)
1. [Improving the availability of your application: pod disruptions budget](#pdb) - [Deploying my first application: deployment](#deploying-my-first-application-deployment)
1. [Improving the elasticity of your applications: HPA, VPA](#hpa-vpa) - [Accessing my first application: service](#accessing-my-first-application-service)
1. [Sidecar containers: what, why, and how](#sidecar-containers-what,-why,-and-how) - [Running a background process: cronjobs](#running-a-background-process-cronjobs)
1. [Running a stateful application: volumes](#running-a-stateful-application-volumes) - [Secrets](#secrets)
1. [Running a stateful application: stateful-sets](#running-a-stateful-application-stateful-sets) - [Liveness and readiness probes, and how it impacts your pods](#liveness-and-readiness-probes-and-how-it-impacts-your-pods)
1. [Controllers: what, why, and how](#controllers-what,-why,-and-how) - [Resources, and how it impacts the scheduling](#resources-and-how-it-impacts-the-scheduling)
1. [Operators and CRDs: what, why, and how](#operators-and-crds-what,-why,-and-how) - [Affinity and anti-affinity](#affinity-and-anti-affinity)
1. [RBAC](#rbac) - [PDB](#pdb)
1. [Other topics](#other-topics) - [HPA, VPA](#hpa-vpa)
1. [Good practices](#good-practices) - [Sidecar containers: what, why, and how](#sidecar-containers-what-why-and-how)
1. [Links](#links) - [Running a stateful application: volumes](#running-a-stateful-application-volumes)
- [Running a stateful application: stateful sets](#running-a-stateful-application-stateful-sets)
- [Controllers: what, why, and how](#controllers-what-why-and-how)
- [Operators and CRDs: what, why, and how](#operators-and-crds-what-why-and-how)
- [RBAC](#rbac)
- [Other topics](#other-topics)
- [Good practices](#good-practices)
- [Links](#links)
## License ## License
@ -33,21 +40,21 @@ This hands-on course in under the [CC BY-NC-SA](./LICENSE) license.
## Prerequisites ## Prerequisites
* Homebrew: <https://brew.sh/> - Homebrew: <https://brew.sh/>
```sh ```sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
``` ```
* Docker: <https://docs.docker.com/docker-for-mac/install/> - Docker: <https://docs.docker.com/docker-for-mac/install/>
```sh ```sh
open https://download.docker.com/mac/stable/Docker.dmg open https://download.docker.com/mac/stable/Docker.dmg
``` ```
* VirtualBox: <https://www.virtualbox.org/wiki/Downloads> - VirtualBox: <https://www.virtualbox.org/wiki/Downloads>
* minikube: <https://github.com/kubernetes/minikube> - minikube: <https://github.com/kubernetes/minikube>
Install minikube and the "ingress" and "metrics-server" addons: Install minikube and the "ingress" and "metrics-server" addons:
@ -55,7 +62,7 @@ Install minikube and the "ingress" and "metrics-server" addons:
$ brew install kubectl $ brew install kubectl
[...] [...]
$ brew cask install minikube $ brew install minikube
[...] [...]
$ minikube start $ minikube start
@ -72,8 +79,12 @@ $ kubectl config current-context
minikube minikube
``` ```
**Note:** the ingress addon is currently not supported on docker for Mac (see https://github.com/kubernetes/minikube/issues/7332). ### (Fixed) docker: Ingress not exposed on MacOS
As a workaround, you have to deploy minikube as a VM and not as a container (using Virtualbox or Hyperkit for example)
[fixed on August 2021](https://github.com/kubernetes/minikube/pull/12089)
**Note:*- the ingress addon not being supported on docker for Mac (see https://github.com/kubernetes/minikube/issues/7332).
As a workaround, you had to deploy minikube as a VM and not as a container (using Virtualbox or Hyperkit for example)
```sh ```sh
$ minikube start --vm=true --vm-driver=virtualbox $ minikube start --vm=true --vm-driver=virtualbox
@ -96,7 +107,7 @@ $ minikube stop && minikube delete && minikube start --vm=true --vm-driver=virtu
You can try another lighter virtual machine layer than Virtualbox You can try another lighter virtual machine layer than Virtualbox
* HyperKit: <https://github.com/moby/hyperkit> - HyperKit: <https://github.com/moby/hyperkit>
```sh ```sh
brew install docker-machine-driver-hyperkit brew install docker-machine-driver-hyperkit
@ -130,7 +141,7 @@ if [ $commands[kubectl] ]; then
fi fi
``` ```
## What this course is and what it's *not* ## What this course is and what it's not
### What this is ### What this is
@ -149,65 +160,65 @@ Kubernetes is an open-source system for managing containerized applications acro
Kubernetes has a number of features. It can be seen as: Kubernetes has a number of features. It can be seen as:
* a container platform, - a container platform,
* a microservices platform, - a microservices platform,
* a portable cloud platform, and a lot more. - a portable cloud platform, and a lot more.
Kubernetes provides a container-centric management environment. It orchestrates computing, networking, and storage infrastructure on behalf of user workloads. This provides much of the simplicity of Platform as a Service (PaaS) with the flexibility of Infrastructure as a Service (IaaS), and enables portability across infrastructure providers. Kubernetes provides a container-centric management environment. It orchestrates computing, networking, and storage infrastructure on behalf of user workloads. This provides much of the simplicity of Platform as a Service (PaaS) with the flexibility of Infrastructure as a Service (IaaS), and enables portability across infrastructure providers.
## Glossary ## Glossary
* **YAML (yml)** - **YAML (yml)**
A markup language that relies on spaces and tabulations. All Kubernetes configuration is written using YAML. A markup language that relies on spaces and tabulations. All Kubernetes configuration is written using YAML.
You will feel the pain of missing tabs and spaces. Feel free to use a linter, such as <http://www.yamllint.com/>. You will feel the pain of missing tabs and spaces. Feel free to use a linter, such as <http://www.yamllint.com/>.
* **Container** - **Container**
*Containers* are an abstraction at the app layer, which packages code and dependencies together. *Containers- are an abstraction at the app layer, which packages code and dependencies together.
* **(Container) image** - **(Container) image**
A lightweight, standalone, executable software package that includes everything you need to run an application: code, runtime, system tools, system libraries and settings. A lightweight, standalone, executable software package that includes everything you need to run an application: code, runtime, system tools, system libraries and settings.
* **Docker** - **Docker**
A software technology providing operating-system-level virtualization, also known as containers. A software technology providing operating-system-level virtualization, also known as containers.
Docker uses the resource isolation features of the Linux kernel, such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others to allow independent “containers” to run within a single Linux instance. This avoids the overhead of starting and maintaining virtual machines (VMs). Docker uses the resource isolation features of the Linux kernel, such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others to allow independent “containers” to run within a single Linux instance. This avoids the overhead of starting and maintaining virtual machines (VMs).
* **kubectl** - **kubectl**
The standard CLI to interact with Kubernetes. We use it a lot in this course. The standard CLI to interact with Kubernetes. We use it a lot in this course.
* **minikube** - **minikube**
A local Kubernetes cluster, useful for testing. We use it a lot in this course. A local Kubernetes cluster, useful for testing. We use it a lot in this course.
* **Manifest** - **Manifest**
Kubernetes configuration files are called *manifests*. This is a reference to the list or invoice of the passengers or goods being carried by a commercial vehicle or ship (from [wiktionary](https://en.wiktionary.org/wiki/manifest#Noun)). Kubernetes configuration files are called *manifests*. This is a reference to the list or invoice of the passengers or goods being carried by a commercial vehicle or ship (from [wiktionary](https://en.wiktionary.org/wiki/manifest#Noun)).
* **(Kubernetes) objects** - **(Kubernetes) objects**
Kubernetes contains a number of abstractions that represent the state of your system: deployed containerized applications and workloads, their associated network and disk resources, and other information about what your cluster is doing. These abstractions are called *objects*, and are represented by a *kind* in the Kubernetes API. Kubernetes contains a number of abstractions that represent the state of your system: deployed containerized applications and workloads, their associated network and disk resources, and other information about what your cluster is doing. These abstractions are called *objects*, and are represented by a *kind- in the Kubernetes API.
* **(Kubernetes) node** - **(Kubernetes) node**
A node is a worker machine in Kubernetes. A node is a worker machine in Kubernetes.
A worker machine may be a VM or physical machine, depending on the cluster. It has the necessary services to run the workloads and is managed by the master components. The services on a node include Docker, `kubelet` and `kube-proxy`. A worker machine may be a VM or physical machine, depending on the cluster. It has the necessary services to run the workloads and is managed by the master components. The services on a node include Docker, `kubelet` and `kube-proxy`.
* **(Kubernetes) cluster** - **(Kubernetes) cluster**
A set of machines, called nodes, that run containerized applications managed by Kubernetes. A set of machines, called nodes, that run containerized applications managed by Kubernetes.
A cluster has several worker nodes and at least one master node. A cluster has several worker nodes and at least one master node.
* **(Kubernetes) master** - **(Kubernetes) master**
The *master* is responsible for managing the cluster. It coordinates all activities in your cluster, such as scheduling applications, maintaining applications desired state, scaling applications, and rolling out new updates. The *master- is responsible for managing the cluster. It coordinates all activities in your cluster, such as scheduling applications, maintaining applications desired state, scaling applications, and rolling out new updates.
A Kubernetes master automatically handles the scheduling of your services across nodes in the cluster. The masters automatic scheduling takes the available resources of each node into account. A Kubernetes master automatically handles the scheduling of your services across nodes in the cluster. The masters automatic scheduling takes the available resources of each node into account.
@ -289,7 +300,7 @@ See the dedicated [README](99-good-practices).
## Links ## Links
* http://kubernetesbyexample.com/ - http://kubernetesbyexample.com/
* https://kubernetes.io/docs/home/ - https://kubernetes.io/docs/home/
* https://kubernetes.io/docs/reference/kubectl/cheatsheet/ - https://kubernetes.io/docs/reference/kubectl/cheatsheet/
* https://hub.docker.com/r/mhausenblas/simpleservice/ - https://hub.docker.com/r/mhausenblas/simpleservice/