diff --git a/docs/00-kubernetes-architecture.md b/docs/00-kubernetes-architecture.md index 2a03f72..96f3cbe 100644 --- a/docs/00-kubernetes-architecture.md +++ b/docs/00-kubernetes-architecture.md @@ -29,4 +29,4 @@ Each worker node includes the following components: During the tutorial, we will configure each component one by one (in a more or less logical way) and try to understand a bit more deeply the responsibilities of each component. -Next: [Container runtime](./docs/01-container-runtime.md) +Next: [Container runtime](./01-container-runtime.md) diff --git a/docs/01-container-runtime.md b/docs/01-container-runtime.md index 89706e7..a20cce4 100644 --- a/docs/01-container-runtime.md +++ b/docs/01-container-runtime.md @@ -201,166 +201,4 @@ Now, lets clean-up. ctr task rm busybox-container ``` -Next: [Kubelet](./docs/02-kubelet.md) - - - - - - - - - - - - - - - - - - - - -Ну раз так то доавайте його втановимо - -Потрібо виключити свап і переконатись що він виключений - -```bash -sudo swapon --show -``` - -```bash -sudo swapoff -a -``` - -Тепер давайте завантажимо всі необхідні бінарні файли для того щоб встановити наш кублєт -```bash -wget -q --show-progress --https-only --timestamping \ - https://github.com/opencontainers/runc/releases/download/v1.0.0-rc93/runc.amd64 \ - https://github.com/containerd/containerd/releases/download/v1.4.4/containerd-1.4.4-linux-amd64.tar.gz \ - https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubelet -``` - -Тепер починаємо робиратись із тим що і для чього ми тільки що завантажували -1. runc - штука яка власне і запускаю контейнери, так давайте її перенесемо куда потрібно -```bash -{ - sudo mv runc.amd64 runc - chmod +x runc - sudo mv runc /usr/local/bin/ -} -``` - - -2. containerd - штука яка використовується кублетом для запуску контейнерів, він рансі відрізняється тим що контейнерді уже вміє окрім запуску самих контейнерів отримувати образи, і робити ще всяких багато різних і цікавих речей, так давайте її відконфігуруємо -```bash -{ - mkdir containerd - tar -xvf containerd-1.4.4-linux-amd64.tar.gz -C containerd - sudo mv containerd/bin/* /bin/ -} -``` - -створимо директорію в якій буде лежати конфіг контейнерді -```bash -sudo mkdir -p /etc/containerd/ -``` - -ну і сам конфіг, а у конфігу сказано що використовувати ми будемо рансі -```bash -cat << EOF | sudo tee /etc/containerd/config.toml -[plugins] - [plugins.cri.containerd] - snapshotter = "overlayfs" - [plugins.cri.containerd.default_runtime] - runtime_type = "io.containerd.runtime.v1.linux" - runtime_engine = "/usr/local/bin/runc" - runtime_root = "" -EOF -``` - -такс, контейнер ді уже готовий, можна створюватиюніт файл для запуску -```bash -cat < An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod. +> The kubelet takes a set of PodSpecs that are provided through various mechanisms and ensures that the containers described in those PodSpecs are running and healthy. + +So, lets set up kubelet and run some pod. + +First of all we need to download kubelet binary -для початку його потрібно завантажити ```bash wget -q --show-progress --https-only --timestamping \ https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubelet ``` +Make file exacutable and move to the bin folder + ```bash { chmod +x kubelet @@ -18,6 +26,8 @@ wget -q --show-progress --https-only --timestamping \ } ``` +And the last part when configuring kubelet - create service to run kubelet. + ```bash cat < Static Pods are managed directly by the kubelet daemon on a specific node, without the API server observing them. + +Before we will create static pod manifests, we need to create folders where we will place our pods (as we can see from kibelet configuration, it sould be /etc/kubernetes/manifests) + ```bash +{ mkdir /etc/kubernetes mkdir /etc/kubernetes/manifests +} ``` +After directory created, we can create static with busybox inside ```bash cat < /etc/kubernetes/manifests/static-pod.yml @@ -93,12 +118,27 @@ spec: EOF ``` -а тепепр поки він його знайде і запустить, ми встановимо crictl +We can check if containerd runned new container +```bash +ctr tasks ls +``` + +Output: +```bash +TASK PID STATUS +``` + +Looks like containerd didn't created any containrs yet? +Of course it may be true, but baed on the output of ctr command we can't answer that question. It is not true (of course it may be true, but based on the output of the ctr command we can't confirm that ////more about that here) + +To see containers managed by kubelet lets install [crictl](http://google.com/crictl). +Download binaries ```bash wget -q --show-progress --https-only --timestamping \ https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.21.0/crictl-v1.21.0-linux-amd64.tar.gz ``` +Install (move to bin folder) ```bash { tar -xvf crictl-v1.21.0-linux-amd64.tar.gz @@ -106,8 +146,7 @@ wget -q --show-progress --https-only --timestamping \ sudo mv crictl /usr/local/bin/ } ``` - -трохи відконфігуруємо +And configure a bit ```bash cat < /etc/crictl.yaml runtime-endpoint: unix:///run/containerd/containerd.sock @@ -117,64 +156,59 @@ debug: false EOF ``` -ну і тепер поки все встановлювалось то наш под мав піднятись -спробуємо подивитись +And we can finaly get the list of pods running on our server ```bash crictl pods ``` -тут є жжназва сервера +Outout: ``` -POD ID CREATED STATE NAME NAMESPACE ATTEMPT RUNTIME -884c50605b546 9 minutes ago Ready static-pod-example-server default 0 (default) +POD ID CREATED STATE NAME NAMESPACE ATTEMPT RUNTIME +16595e954ab3e 8 minutes ago Ready static-pod-example-server default 0 (default) ``` -і контейнери +As we can see our pod is up and running. + +Also, we can check the containers running inside our pod ```bash crictl ps ``` +Output: ``` CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID -4cc95ba71e9d6 7cfbbec8963d8 10 minutes ago Running busybox 0 884c50605b546 +912487fb63f9e 7cfbbec8963d8 10 minutes ago Running busybox 0 16595e954ab3e ``` -ну і також можна глянути логи +Looks like our container is in running state. +Lets check its logs. ```bash crictl logs $(crictl ps -q) ``` +Output: ``` -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod -Hello from static hostNetwork pod +Hello from static pod +Hello from static pod +Hello from static pod +... ``` -такс, ну на цьому нам потрібно почитити все після себе +Great, now we can run pods on our server. +Before we will continue, remove our pods running ```bash rm /etc/kubernetes/manifests/static-pod.yml ``` -тепер має видалитись контейнер, але потрібно трохи почекати -```bash -crictl ps -``` - -тут пусто - +It takes some time to remove the pods, we can ensure that pod are deleted by running ```bash +{ crictl pods +crictl ps +} ``` -і тут з часом також має стати пусто +The output shuld be empty. -ну всьо, на цьому на сьогодні все поки -далі будемо розбиратись із іншими компонентами кудетнетесу \ No newline at end of file +Next: [Pod networking](./03-pod-networking.md) \ No newline at end of file