Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy single Node in Kubernetes binary deployment

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to implement single-node deployment in Kubernetes binary deployment, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following for you. I hope you can get something from this article.

Kubernetes Cluster Architecture Diagram:

Each node component and its meaning:

1. Master component kube-apiserver

Kubernetes API, the unified entrance to the cluster and the coordinator of each component, provides interface services through RESTful API. All object resource additions, deletions, modifications, and monitoring operations are handed over to APIServer and then submitted to Etcd for storage.

Kube-controller-manager

Handle the regular background tasks in the cluster, each resource corresponds to a controller, and ControllerManager is responsible for managing these controllers.

Kube-scheduler

According to the scheduling algorithm, select a Node node for the newly created Pod, which can be deployed arbitrarily, on the same node or on different nodes.

Etcd

Distributed key storage system. Used to save cluster state data, such as Pod, Service and other object information.

2. Node component kubelet

Kubelet is the Agent of Master on the Node node, which manages the lifecycle of native running containers, such as creating containers, mounting data volumes on Pod, downloading secret, getting container and node status, and so on. Kubelet converts each Pod into a set of containers.

Kube-proxy

Implement Pod network agent on Node node, maintain network rules and four-layer load balancing work.

Docker or rocket

Container engine, run the container.

> # how it works:

1. Prepare the yml file containing the Deployment of the application, and then send it to ApiServer through the kubectl client tool.

2. ApiServer receives the request from the client and stores the resource content in the database (etcd).

3. Controller components (including scheduler, replication, endpoint) monitor resource changes and respond.

4. ReplicaSet checks the database changes and creates the desired number of pod instances.

5. Scheduler checks the database changes again and finds the Pod that has not been assigned to the specific execution node (node), then assigns the pod to the node where they can run according to a set of relevant rules, and updates the database to record the pod allocation.

6. Kubelete monitors database changes, manages the life cycle of subsequent pod, and discovers those pod that are assigned to run on the node where it is located. If a new pod is found, the new pod is run on that node.

Attachment: kuberproxy runs on each host of the cluster and manages network communication, such as service discovery and load balancing. When data is sent to the host, it is routed to the correct pod or container. For data sent from the host, it can discover the remote server based on the request address and route the data correctly, in some cases using the round robin scheduling algorithm (Round-robin) to send requests to multiple instances in the cluster.

Kubernetes core concepts 1, Pod

Minimum deployment unit

A collection of containers

A container shared network namespace in Pod

Pod is short-lived

2 、 Controllers

ReplicaSet: ensure the expected number of Pod copies

Deployment: stateless application deployment

StatefulSet: stateful application deployment

DaemonSet: make sure all Node are running the same Pod

Job: one-time task

Cronjob: scheduled task

Higher-level objects, deploying and managing Pod

3 、 Service

Prevent Pod from losing contact

Define a set of access policies for Pod

Label: tags attached to a resource for associating objects, queries, and filtering

Namespaces: namespace to logically isolate objects

Annotations: comment

Kubernetes cluster deployment 1. Three official deployment methods, minikube

Minikube is a tool that can quickly run a single point of Kubernetes locally for use only by users trying Kubernetes or daily development.

Deployment address: https://kubernetes.io/docs/setup/minikube/

Kubeadm

Kubeadm is also a tool that provides kubeadm init and kubeadm join for rapid deployment of Kubernetes clusters.

Deployment address: https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm/

Binary packet

It is recommended that you download the released binary package from the official version and deploy each component manually to form a Kubernetes cluster.

Download address: https://github.com/kubernetes/kubernetes/releases

2. Kubernetes architecture diagram

3. Certificates used by the self-signed SSL certificate component etcdca.pem, server.pem, server-key.pemflannelca.pem,server.pem, server-key.pemkube- apiserverca.pem, server.pem, server-key.pemkubeletca.pem, ca-key.pemkube-proxyca.pem, kube-proxy.pem, kube-proxy-key.pemkubectlca.pem, admin.pem, admin-key.pem4. Etcd database cluster deployment

Binary package download address

Https://github.com/etcd-io/etcd/releases

K8s single node deployment idea: the first part

1. Self-signed ETCD certificate

2. ETCD deployment

3. Node install docker

4. Flannel deployment (write subnet to etcd first)

Part II (master)

1. Self-signed APIServer certificate

2. Deploy APIServer components (token,csv)

3. Deploy controller-manager (specify apiserver certificate) and scheduler components

Part III (node)

1. Generate kubeconfig (bootstrap,kubeconfig and kube-proxy.kubeconfig)

2. Deploy kubelet components

3. Deploy kube-proxy components

Part IV (joining the Cluster)

1. Kubectl get csr & & kubectl certificate approve allows you to issue certificates and join the cluster

2. Add a node node

3. View the kubectl get node node

K8s deployment planning: load balancing

Nginx1:192.168.35.104/24

Nginx2:192.168.35.105/24

Master node

Master1:192.168.35.100/24

Master2:192.168.35.103/24

Node node

Node1:192.168.35.101/24

Node2:192.168.35.102/24

The first part 1.1self-signed ETCD certificate 1.1.1, Master operation: [root@localhost ~] # mkdir K8s [root@localhost ~] # cd k8s/ [root@localhost K8s] # ls # # dragged in from the host etcd-cert.sh etcd.sh [root@localhost K8s] # mkdir etcd-cert [root@localhost K8s] # mv etcd-cert.sh etcd-cert the following is the content of the etcd.sh script vim etcd.shengxinxinxambash # example:. / etcd.sh etcd01 192.168.1.10 etcd02= Bash Etcd03= https://192.168.1.12:2380ETCD_NAME=$1ETCD_IP=$2ETCD_CLUSTER=$3WORK_DIR=/opt/etcdcat

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report