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

Introduction to Kubernetes Cluster components

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Today, Xiaobian shared with you the introduction of Kubernetes cluster components. I believe most people don't know much about it. In order to let everyone know more, Xiaobian summarized the following contents for everyone. Let's not say much. Let's look down together.

KubernetesKubernetes is an open source Docker container orchestration system, Kubernetes for short K8S.

Scheduling nodes of a computing cluster and dynamically managing jobs on them

By using the concepts of [labels] and [pods], applications are grouped by logical units

K8S for deployment, scaling and management of container applications

K8S provides a series of functions such as container orchestration, resource scheduling, Auto Scaling, deployment management and service discovery.

Kubernetes aims to make deployment containerized simple and efficient

Official website: www.kubernetes.io

Features of Kubernetes

Self-healing:

Restart failed containers upon node failure, replace and redeploy, guarantee predicted replica count; kill containers that fail health checks, and do not process client requests until they are ready, ensuring online service is uninterrupted.

Auto Scaling:

Use commands, UI, or automatically scale up and down application instances based on CPU usage to ensure high availability at peak concurrency; reclaim resources at low business peaks to run services at minimum cost

Automatic deployment and rollback:

K8S uses rolling updates to update the app, one pod at a time, rather than deleting all pods at once. If there is a problem during the update process, the changes will be rolled back to ensure that the upgrade will not affect the business.

Service Discovery and Load Balancer:

K8S provides a unified access portal (internal IP address and UI DNS address) for multiple containers, and Load Balancer all associated containers, so that users do not need to consider container IP issues

Confidentiality and configuration management:

Manage confidential data and application configuration. Without exposing sensitive data to mirrors, security of sensitive data is improved. And you can store some commonly used configurations in K8S for easy application use.

Storage layout:

Mount external storage systems, whether from on-premises storage, public cloud (e.g. AWS), or networked storage (NFS, GlusterFS) as part of cluster resources, greatly increasing storage flexibility

Batch:

Provide one-time tasks, scheduled tasks; meet the scenarios of batch data processing and analysis.

Kubernetes Cluster Architecture and Components

master component

kube-apiserver:

Kubernetes API, the unified entry point of the cluster, coordinator of each component, provides interface services through RESTful API, and all object resource addition, deletion, modification and monitoring operations are handed over to API Server for processing and then submitted to Etcd storage.

kube-controller-manager:

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

kube-scheduler:

Select a Node node for the newly created Pod according to the scheduling algorithm. It can be deployed arbitrarily, on the same node, or on different nodes.

etcd:

Distributed key-value storage system, used to store cluster state data, such as Pod, Server and other object information.

node component

kubelet:

Kubelet is MAster's Agent on Node, which manages the lifecycle of local running containers, such as creating containers, Pod mounting data volumes, downloading secrets, obtaining container and node status, etc. Kubelet transforms a Pod into a set of containers.

kube-proxy:

Implement Pod network agents on Noed nodes to maintain network planning and four-layer complex = Load Balancer operations

Docker or Rocket:

Container engine, running containers

Kubernetes Core Concepts

Pod:

minimum deployment unit

A collection of containers

Containers in a Pod share a network namespace

Pod is transient.

Controllers:

ReplicaSet: Ensure the expected number of Pod copies

Deployment : stateless application deployment

StatefulSet: stateful app deployment

DaemonSet : Make sure all nodes run the same Pod

Job: One-time job

Cronjob: timed task

Higher-level objects, deploying and managing pods

Service:

Prevent Pod loss

Define an access policy for a set of pods

Label: Label attached to an asset to associate objects. Query and Filter

Namespaces: namespaces that logically isolate objects

Annotations: Comments

Flannel Container Cluster Network Deployment

minikube

minikube is a tool that can quickly run a single-point kubernetes locally, only for users who try k8s or daily development

Experimental environment master 192.168.13.131 install etcd kubernetes flannelnode 192.168.13.132 Install flannel kubernetes

One Configure etcd on master [root@promote ~]# yum install etcd kubernetes flannel -y ##Install components [root@promote ~]# vim /etc/etcd/etcd.conf ##Configure etcd configuration files

3 ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ##Data directory

6 ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379" ##Listens on arbitrary networks and ports

9 ETCD_NAME="default" ##Default Name

21 ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379" ##Cluster Access Address Paragraph

Second, configure apiserver on master [root@promote ~]# vim /etc/kubernetes/apiserver ##Configure apiserver configuration file

8 KUBE_API_ADDRESS="--address=0.0.0.0" ##Modify api address

11 KUBE_API_PORT="--port=8080" ##api listening port number

14 KUBELET_PORT="--kubelet-port=10250" ##kubelet port number

17 KUBE_ETCD_SERVERS="--etcd-servers=http://127.0.0.1:2379" ##etcd service address

20 KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range= 10.254.0.0/16" ##Service address pool

23 KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExis ts,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"

##Controller Mode

26 KUBE_API_ARGS="" ##api parameter

Third, configure the flannel network on the master [root@promote ~]# vim /etc/sysconfig/flanneld

FLANNEL_ETCD_ENDPOINTS="http://192.168.13.131:2379" ##modify etcd address to the address of this machine

FLANNEL_ETCD_PREFIX="/atomic.io/network" ##Network specified file

4. Start all services on master [root@promote ~]# for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES; systemctl enable $SERVICES; systemctl status $SERVICES; done##Start etcd kube-apiserver kube-controller-manager kube-scheduler, set startup and check status

5. Set etcd network on master [root@promote ~]# etcdctl -C //192.168.13.131:2379 set /atomic.io/network/config '{"Network":"10.1.0.0/16"}'[root@promote ~]# systemctl stop firewall.service ##turn off firewall [root@promote ~]# setenforce 0

VI, configure kubernetes configuration file in node server [root@promote ~]# yum install flannel kubernetes -y[root@promote ~]# vim /etc/kubernetes/config

13 KUBE_LOGTOSTDERR="--logtostderr=true" ##Error log

16 KUBE_LOG_LEVEL="--v=0" ##Level

19 KUBE_ALLOW_PRIV="--allow-privileged=false" ##Permission

22 KUBE_MASTER="--master=http://192.168.13.131:8080" ##Specify master address

23 KUBE_ETCD_SERVERS="--etcd_server=http://192.168.13.131:2379" ##Specify etcd address

Seven, configure kubelet configuration file [root@promote ~]# vim /etc/kubernetes/kubeletKUBELET_ADDRESS="--address=0.0.0.0" ##All addresses KUBELET_PORT="--port=10250" ##Port Number KUBELET_HOSTNAME="--hostname-override=192.168.13.132" ##Local Host Address KUBELET_API_SERVER="--api-servers=http://192.168.13.131:8080" ##apiserver Address KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image= registry.access.redhat.com/rhel7/pod-infrastructure:latest"##pod Container KUBELET_ARGS="" ##Parameters

Eight, configure the flannel network configuration file [root@promote ~]# vim /etc/sysconfig/flanneld FLANNEL_ETCD_ENDPOINTS="http://192.168.13.131:2379" ##Specify the etcd service address

9, Open all services in node [root@promote ~]# systemctl stop firewalld.service ##turn off firewall [root@promote ~]# setenforce 0[root@promote ~]# for SERVICES in flanneld kube-proxy kubelet docker; do systemctl restart $SERVICES; systemctl enable $SERVICES; systemctl status $SERVICES; done##turn on flanneld kube-proxy kubelet docker service

ten, check node [root@promote ~]# kubectl get nodesNAME on master server STATUS AGE192.168.13.132 Ready 1m

After reading the above, do you have a general understanding of Kubernetes cluster components? If you want to know more about related articles, welcome to pay attention to the industry information channel, thank you for reading!

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