<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>2. Core Concepts :: Kubernetes Labs</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/index.html</link><description>This chapter covers the building blocks of Kubernetes, from the components of a cluster to running, exposing and configuring your applications.
What You Learn By the end of this chapter, you can:
name the components of a Kubernetes cluster and find them in your own cluster create and inspect resources with kubectl, both imperatively and with YAML manifests run applications as a Pod, Deployment, DaemonSet, StatefulSet, Job or CronJob make applications reachable with a Service, inside the cluster and from your machine configure applications with a ConfigMap and a Secret and store their data with a PersistentVolumeClaim find out why a workload doesn’t run and fix it make workloads robust with probes and resource limits, and scale them automatically Sections Section In the lab 2.1. Kubernetes Architecture Create your cluster and explore its components 2.2. kubectl and Manifests Work with contexts, the API and YAML manifests 2.3. Pods Run Pods with init and sidecar containers, labels and namespaces 2.4. Deployments Scale, update and roll back an application 2.5. Beyond Deployments Run DaemonSets, StatefulSets, Jobs and CronJobs 2.6. Services and Networking Reach apps via DNS, port forwarding and NodePort; blue/green 2.7. Configuration Configure an application with ConfigMaps and Secrets 2.8. Storage Keep data with volumes and PersistentVolumeClaims 2.9. Health and Resources Add probes, set requests and limits, autoscale under load 2.10. Troubleshooting Debug failing workloads with events, logs, top and exec How the Labs Work Each section starts with the theory in the presentation. The lab then puts it into practice. In 2.1, you create a local k3s cluster with k3d. You use this cluster for all labs. The cluster runs without an Ingress controller and without a load balancer. You reach your applications with port forwarding or a NodePort. Each lab ends with optional tasks. If you finish early, go ahead with them. The following labs don’t depend on them. Prerequisites All tools from 1. Setup must be installed and verified.</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://kubernetes.idsc.arch.cloud/2-core-concepts/index.xml" rel="self" type="application/rss+xml"/><item><title>2.1. Kubernetes Architecture</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/1-kubernetes-architecture/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/1-kubernetes-architecture/index.html</guid><description>In this lab, you create the cluster you use for all labs and find the components of the Kubernetes architecture in it.
Step 1: Create the Cluster Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.1 cd ~/labs/2.1 Create the file registries.yaml in ~/labs/2.1. It makes the nodes download images from Docker Hub through a mirror:</description></item><item><title>2.2. kubectl and Manifests</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/2-kubectl-and-manifests/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/2-kubectl-and-manifests/index.html</guid><description>In this lab, you see how kubectl finds your cluster, create a Pod in two different ways and explore the API.
Step 1: Inspect the Context kubectl reads the connection details of your clusters from the kubeconfig (~/.kube/config). List the contexts it contains:
kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE * k3d-labs k3d-labs admin@k3d-labs If you have worked with other clusters before, you see more contexts. The * marks the current one.</description></item><item><title>2.3. Pods</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/3-pods/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/3-pods/index.html</guid><description>In this lab, you follow a Pod through its lifecycle, run several containers in one Pod, organize Pods with labels and separate them with namespaces.
Step 1: Follow the Lifecycle of a Pod Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.3 cd ~/labs/2.3 Create the file countdown.yaml in ~/labs/2.3. The Pod counts down from 5 and then ends:</description></item><item><title>2.4. Deployments</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/4-deployments/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/4-deployments/index.html</guid><description>In this lab, you run an application as a Deployment, scale it, roll out a new version, roll it back and change it directly in the cluster.
Step 1: Create a Deployment Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.4 cd ~/labs/2.4 Create the file web.yaml in ~/labs/2.4 with a Deployment that runs three nginx Pods:</description></item><item><title>2.5. Beyond Deployments</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/5-beyond-deployments/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/5-beyond-deployments/index.html</guid><description>In this lab, you run a Pod on every node with a DaemonSet, give Pods a stable identity with a StatefulSet and run tasks once with a Job or on a schedule with a CronJob, which you then pause.
Step 1: Run a Pod on Every Node Create a directory for the files of this lab and change into it:</description></item><item><title>2.6. Services and Networking</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/6-services-and-networking/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/6-services-and-networking/index.html</guid><description>In this lab, you make an application reachable with a Service: inside the cluster, from your machine and with two versions to switch between.
Step 1: Create a Service Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.6 cd ~/labs/2.6 Create the file web-blue.yaml in ~/labs/2.6. The application whoami replies with the name of the Pod that answers, so you can see where each request ends up:</description></item><item><title>2.7. Configuration</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/7-configuration/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/7-configuration/index.html</guid><description>In this lab, you keep configuration and passwords out of the container image and pass them to your Pods as environment variables and as files.
Step 1: Create a ConfigMap Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.7 cd ~/labs/2.7 Create the file app-config.yaml in ~/labs/2.7 with a ConfigMap that holds two settings:</description></item><item><title>2.8. Storage</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/8-storage/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/8-storage/index.html</guid><description>In this lab, you see how long data lives in a volume: as long as its Pod, or beyond it with a PersistentVolumeClaim.
Step 1: Lose Data with an emptyDir Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.8 cd ~/labs/2.8 Create the file scratch.yaml in ~/labs/2.8. Its init container adds a line to the file /data/log.txt, and its main container prints the file:</description></item><item><title>2.9. Health and Resources</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/9-health-and-resources/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/9-health-and-resources/index.html</guid><description>In this lab, you tell Kubernetes when your application is ready and alive, how much CPU and memory it needs, and let it scale the application automatically under load.
Step 1: Check Readiness with a Probe Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.9 cd ~/labs/2.9 Create the file web.yaml in ~/labs/2.9. The whoami application from 2.6 answers on /health and lets you switch that answer to an error, so you can make a Pod unhealthy on purpose:</description></item><item><title>2.10. Troubleshooting</title><link>https://kubernetes.idsc.arch.cloud/2-core-concepts/10-troubleshooting/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kubernetes.idsc.arch.cloud/2-core-concepts/10-troubleshooting/index.html</guid><description>In this lab, you find and fix four broken workloads with the troubleshooting tools of Kubernetes.
Step 1: Find the Broken Pods A colleague deployed a small shop application, but nothing works. Create a directory for the files of this lab and change into it:
mkdir -p ~/labs/2.10 cd ~/labs/2.10 Create the file shop.yaml in ~/labs/2.10 with the colleague’s four Deployments. --- separates several manifests in one file. The containers simulate the applications with small shell scripts. You don’t need to understand them to find the errors:</description></item></channel></rss>