|
| 1 | +# What is Kubernetes? |
| 2 | + |
| 3 | +<v-clicks> |
| 4 | + |
| 5 | +Kubernetes is an open-source container orchestration system for automating software deployment, scaling, and management. |
| 6 | + |
| 7 | +</v-clicks> |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +# How can I **safely** test Kubernetes? |
| 12 | + |
| 13 | +<v-click> |
| 14 | + |
| 15 | +## [Minikube](https://minikube.sigs.k8s.io/docs/) |
| 16 | + |
| 17 | +...creates a test cluster right on your computer using either **containers** or **VMs** |
| 18 | + |
| 19 | +</v-click> |
| 20 | + |
| 21 | +<v-click> |
| 22 | + |
| 23 | +```shell |
| 24 | +minikube start --nodes 3 |
| 25 | +``` |
| 26 | + |
| 27 | +This deploys a development Kubernetes cluster composed of 3 nodes |
| 28 | + |
| 29 | +</v-click> |
| 30 | + |
| 31 | +<v-space size="md" /> |
| 32 | + |
| 33 | +<v-click> |
| 34 | + |
| 35 | +```shell |
| 36 | +kubectl get nodes |
| 37 | +``` |
| 38 | + |
| 39 | +To check if the 3 nodes are correctly set up |
| 40 | + |
| 41 | +</v-click> |
| 42 | + |
| 43 | +<man command="kubectl" v-click> |
| 44 | +kubectl controls the Kubernetes cluster manager. |
| 45 | +</man> |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## Let's use the glorified podman |
| 50 | + |
| 51 | +<v-space size="md" /> |
| 52 | + |
| 53 | +<v-click> |
| 54 | + |
| 55 | +```shell |
| 56 | +kubectl run -it --image=alpine iwannabeubuntu sh |
| 57 | +``` |
| 58 | + |
| 59 | +<man command="kubectl run"> |
| 60 | +Create and run a particular image in a pod. |
| 61 | +</man> |
| 62 | + |
| 63 | +</v-click> |
| 64 | + |
| 65 | +<v-space size="md" /> |
| 66 | + |
| 67 | +<v-click> |
| 68 | + |
| 69 | +```shell |
| 70 | +kubectl get pods |
| 71 | +``` |
| 72 | + |
| 73 | +<man command="kubectl get"> |
| 74 | +Display one or many resources. |
| 75 | +</man> |
| 76 | + |
| 77 | +</v-click> |
| 78 | + |
| 79 | +<v-click> |
| 80 | + <p class="text-8 pt-10">That's it? Then why use Kubernetes?</p> |
| 81 | +</v-click> |
| 82 | + |
| 83 | +--- |
| 84 | +layout: two-cols-header |
| 85 | +title: Useful definitions |
| 86 | +--- |
| 87 | + |
| 88 | +<div class="text-center"> |
| 89 | + |
| 90 | +# Imperative vs Declarative |
| 91 | + |
| 92 | +</div> |
| 93 | + |
| 94 | +<v-space size="sm" /> |
| 95 | + |
| 96 | +::left:: |
| 97 | + |
| 98 | +<p v-click="1">I specify a task to be executed</p> |
| 99 | + |
| 100 | +<i v-click="3">e.g., "Clean the room"</i> |
| 101 | + |
| 102 | +<p v-click="5">You have to perform the required task, |
| 103 | +and once completed, |
| 104 | +it's no longer your responsibility</p> |
| 105 | + |
| 106 | +<div v-click="7" class="grid grid-cols-2 gap-4 pt-10 px-20 text-center"> |
| 107 | + <div> |
| 108 | + <img src="/icons/ansible.svg" alt="ansible logo" class="h-20 mx-auto" /> |
| 109 | + <p>Ansible</p> |
| 110 | + </div> |
| 111 | + <div> |
| 112 | + <img src="/icons/podman.svg" alt="podman logo" class="h-20 mx-auto" /> |
| 113 | + <p class="text-center">Podman</p> |
| 114 | + </div> |
| 115 | +</div> |
| 116 | + |
| 117 | +::right:: |
| 118 | + |
| 119 | +<p v-click="2">I declare a desired state</p> |
| 120 | + |
| 121 | +<i v-click="4">e.g., "The room must be clean"</i> |
| 122 | + |
| 123 | +<p v-click="6">You have to maintain the desired state until a new state is declared</p> |
| 124 | + |
| 125 | +<div v-click="8" class="grid grid-cols-2 gap-4 pt-10 px-20 text-center"> |
| 126 | + <div> |
| 127 | + <img src="/icons/opentofu.svg" alt="opentofu logo" class="h-20 mx-auto" /> |
| 128 | + <p>OpenTofu<br/><small>(Terraform)</small></p> |
| 129 | + </div> |
| 130 | + <div> |
| 131 | + <img src="/icons/kubernetes.svg" alt="kubernetes logo" class="h-20 mx-auto" /> |
| 132 | + <p class="text-center">Kubernetes</p> |
| 133 | + </div> |
| 134 | +</div> |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +# Kubernetes resources |
| 139 | + |
| 140 | +These are defined by `yaml` manifests |
| 141 | + |
| 142 | +```yaml {none|1|2|3-5|6|all}{lines: true} |
| 143 | +apiVersion: <api_version> |
| 144 | +kind: <kind_of_resource> |
| 145 | +metadata: |
| 146 | + name: <resource_name> |
| 147 | + # other metadata |
| 148 | +# resource specification |
| 149 | +``` |
| 150 | + |
| 151 | +<<< @/snippets/manifests/pods/pod-echo-server.yaml yaml[resource.yaml]{hide|all}{lines:true} |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## Create a resource |
| 156 | + |
| 157 | +```shell |
| 158 | +kubectl apply -f resource.yaml |
| 159 | +``` |
| 160 | + |
| 161 | +<man command="kubectl apply"> |
| 162 | +Apply a configuration to a resource by file name or stdin. |
| 163 | +The resource name must be specified.<br/> |
| 164 | +This resource will be created if it doesn't exist yet.<br/><br/> |
| 165 | +JSON and YAML formats are accepted. |
| 166 | +</man> |
| 167 | + |
| 168 | +--- |
| 169 | +layout: center |
| 170 | +class: text-center |
| 171 | +--- |
| 172 | + |
| 173 | +## You require a resource... |
| 174 | + |
| 175 | +<v-space size="sm" /> |
| 176 | + |
| 177 | +<<< @/snippets/diagrams/kubeapi.mermaid mermaid {scale: 0.95} |
| 178 | + |
| 179 | +--- |
| 180 | +layout: center |
| 181 | +class: text-center |
| 182 | +--- |
| 183 | + |
| 184 | +## ...a controller provisions it |
| 185 | + |
| 186 | +<v-space size="sm" /> |
| 187 | + |
| 188 | +<<< @/snippets/diagrams/controller.mermaid mermaid {scale: 0.65} |
| 189 | + |
| 190 | +--- |
| 191 | +title: Operator pattern |
| 192 | +routeAlias: operator-pattern |
| 193 | +--- |
| 194 | + |
| 195 | +## [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/) |
| 196 | + |
| 197 | +<v-space size="sm" /> |
| 198 | + |
| 199 | +This is what makes Kubernetes really powerful |
| 200 | + |
| 201 | +<span v-click>You require a resource...</span> <span v-click><carbon-arrow-right class="mb-[-4px]" /> ...a controller provisions it</span> |
| 202 | + |
| 203 | +<p v-click class="text-5 pt-20">A little spoiler:</p> |
| 204 | +<p v-after class="font-italic">Relying on this mechanism, you can extend the Kubernetes functionality,<br/>creating custom resource schemas and controllers.</p> |
| 205 | + |
| 206 | +<p v-click>We'll come back to it later</p> |
| 207 | + |
| 208 | +--- |
| 209 | + |
| 210 | +# So, why should I use Kubernetes? |
| 211 | + |
| 212 | +<v-space size="md" /> |
| 213 | + |
| 214 | +<div class="text-7"> |
| 215 | +<v-clicks> |
| 216 | + |
| 217 | +- It's the industry standard |
| 218 | +- Everyone's using it |
| 219 | +- Tell it what you want, not how to do it |
| 220 | +- You can extend it however you need <small>(through the operator pattern)</small> |
| 221 | + |
| 222 | +</v-clicks> |
| 223 | +</div> |
0 commit comments