You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Kubernetes/Kubernetes Workshop

From Wikitech-static
Jump to navigation Jump to search

The purpose of the Kubernetes Workshop is to provide an introduction to docker, kubernetes (minikube and others) and the path to production use of kubernetes within the foundation. The idea is to be able to step through the exercises on your own a get a basic understanding of these technologies.

Foreword Introduction

Kubernetes, often written as K8s (a numeronym, similar to I18n or l8n) is an open-source orchestration system that automates computer application deployment, supports application scaling, and provides facilities for application management.

The goal of this workshop is to provide practical experience in running sample applications on k8s. Good general Linux knowledge is required and basic knowledge with docker and its uses is helpful. If docker knowledge is missing, the appendix has links to docker tutorials that will provide the basic knowledge necessary.

K8s runs on top of multiple Linux systems that together form a k8s cluster. The cluster is composed of the management systems (control plane) and nodes, dedicated systems that the Linux based applications execute on. Applications are deployed as docker images and run as containers inside pods on the nodes. Application resources are controlled through the cgroups kernel feature. K8s can run containers based on Windows on specialized k8s nodes running the Windows 2019 operating system, where they are controlled by Windows Server Containers

K8s is widely used for large scale application deployments - take a look at the Kubecon videos on youtube, for example this one by Cruise who talk about their number of clusters and nodes and this one which looks at the achieved benefits. K8s is not the best solution for all environments, this article gives some interesting points for example

The Wikimedia Foundation uses k8s in a number of scenarios, Wikimedia Cloud Services runs  k8s in Toolforge and SRE ServiceOps runs k8s as a platform for microservices uses.

We will be using a local installation of k8s called minikube, store docker image files on dockerhub, use Github, check out hosted k8s on Google Cloud Platform and run a generic k8s cluster on WMCS. In the later part we will use the foundation’s deployment pipeline tools, including gerrit, blubber and the whole CI/CD system.

Steps

We estimate that each step will take between 2-3 hours to read and execute.

Preparation

Install docker (https://docs.docker.com/engine/install/ubuntu/ for Ubuntu, others are there as well) and run the test docker image (hello-world). Then install minikube on your machine and test it (https://kubernetes.io/docs/tutorials/hello-minikube/). In addition please create an account on dockerhub - https://hub.docker.com/. We have tested mainly on Linux. If you are running on other platforms (Mac or Windows most likely) everything should work, but it might be smoother to run the workshop on a VM, either locally on your machine, at WMCS or other places that you have access to. A VM with 2 CPUs, 4 GB memory and 40 GB disk works nicely. On the Mac the following links have help in the setup: python3, docker and minikube.

Some early feedback for Mac users on Big Sur, use this for the base setup: https://gerrit.wikimedia.org/r/plugins/gitiles/releng/local-charts/+/HEAD/bin/mac_prereq.sh.

Kubernetes Workshop Step 1 - running a simple batch application on a local k8s installation

Kubernetes Workshop Step 2 - run a service application on your local k8s

Kubernetes Workshop Step 3 - Infrastructure as Code in K8s with YAML

Kubernetes Workshop Step 4 - More on Scale and YAML

Kubernetes Workshop Step 5 - Configurations

Kubernetes Workshop Step 6 - a "real" cluster

Kubernetes Workshop Step 7 - Packages

Kubernetes Workshop Step 8 - Manageability and Security

Kubernetes Workshop Step 9 - Wikimedia Foundation Style Kubernetes

Kubernetes Workshop Step 10 - Running your own service under WMF Kubernetes

Kubernetes Workshop Add-on - Load Testing

Previous Work

Old draft at: https://docs.google.com/document/d/1bccjDlu3v-6aHTdlMvH1Z3XiJ3lRNGe4hWTMYf3_1Ac/edit