📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Как запустить Kubernetes локально: пошаговая инструкция с Minikube | Курс K8s Zero to Hero 2/10

Флант5:44

Transcription

Kubepods are the foundation. A cluster of pods. Pods in a cluster. The top of the cluster. Kubepods [music] are the foundation. Kubepods are the foundation. Hello everyone. My name is Kirill Razumov. I am a DevOps engineer at FLAN company. In the previous video, we got acquainted with Kubernetes, and in this one, we are already starting with practice. Our first task is to prepare a convenient and simple working environment where we can safely experiment. For this, we will need a version control system. All code, both applications and infrastructure, is conventionally stored in a Git repository. This allows tracking all changes and working in a team. In this series of videos, we will use GitHub, as it is one of the most convenient services for our purpose. It also provides a container registry, which we will need later. So, we already have a repository where the source code of our application is located. As a first step, you need to create a fork of this repository to go through all the steps with me. To do this, in the upper right part of the screen, go to the Fork tab and click the Create New Fork button. Done. Our fork is created. Now that the fork is created in the cloud, let's copy it to our computer to start working with the files. This process is called cloning. To do this, we will execute the Git Clone command with the URL of our repository. I will use PSS connection. Excellent, the repository has been successfully cloned. Next, I will work in the command line, and edit files in Vim. You can use any convenient IDE, for example. The result will be the same. Using the command line is a necessary skill in DevOps, as you often have to work with servers that simply do not have a graphical interface. Now that we have a place to store code, let's move on to the main tool. We want to learn Kubernetes, but deploying a full-fledged industrial cluster is difficult, time-consuming, and expensive. Therefore, we will launch a fully functional, but simplified Kubernetes cluster directly on your computer. For this, there is a special tool, Minikube. Our cluster will consist of only one node, but this is more than enough to learn all the basic concepts of Kubernetes. For Minikube to work, a container runtime environment is absolutely necessary. This is a program that launches and manages containers. The most popular such program is Docker Desktop. Before installing Minikube, make sure that Docker Desktop is installed on your system and, importantly, is running. You can check this using the Docker Desktop status command. I will leave a link to the official Docker Desktop website in the video description so you can download the installer. Now let's install Minikube itself. The official website has instructions for all operating systems. I am working on MacOS with an ARM architecture, so I will use the Homebrew package manager and execute the simple command Brew Install Minikube. Minikube is installed. Let's start our cluster. The main command for this is Minikube start. The launch was successful. Minikube downloaded the necessary images and configured the cluster. The output in the console tells us that everything is ready. The cluster is running, but how do we communicate with it, for example, give commands, check its status? For this, there is the main Kubernetes administrator tool, the kubectl utility. If you already have kubectl installed, you can use it. If not, you can use kubectl from Minikube, which comes bundled with it. To execute a command, you need to use the Minikube kubectl command construct. Let's check the status of our cluster by getting a list of its nodes with the command Minikube kubectl get nodes. On the first launch, Minikube will download a plugin for kubectl, so you will have to wait a bit. We see one node in the list. This is our local cluster, which Minikube launched. So, everything is working for us. If you don't see the list of nodes, try repeating the command in a couple of minutes. Perhaps the cluster has not started yet. If even after that there is nothing in the terminal, go back to the beginning and repeat the entire process, paying attention to errors. And finally, let's figure out how kubectl understands which specific cluster to connect to. When Minikube starts, it automatically adds connection information to a special configuration file located in your home directory at ~/.kube/config. This file can be compared to an address book. It stores the addresses of your clusters, certificates, and authentication data. The kubectl utility reads this file every time it is launched. So, in this video, we have created a Git repository for our project, learned what Minikube is and why it is needed. installed Minikube and its dependencies, including Docker Desktop, launched our first local Kubernetes cluster, got acquainted with the kubectl utility, and executed the first command. Our working environment is fully ready. In the next video, we will deploy our first application to the cluster. In the meantime, write in the comments whether everything was clear and if you managed to set up your working environment. If something went wrong, ask questions, we will try to help, because without a properly configured environment, working with Kubernetes will be difficult. I remind you that all links are in the video description. Give likes, subscribe to the channel so you don't miss new episodes, and share this video with friends who also want to master Kubernetes. See you soon.