In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to install K8s cluster". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Step 1: prepare 1. Virtual machine preparation
Prepare three virtual machines:
Hostname IP system version installation service function description master172.17.142.244centOS 7.41 cluster master node node1172.17.142.252centOS 7.42 cluster node node node2172.17.142.246centOS 7.41 cluster node node 2. Initialize the virtual machine
Add the configuration to the hosts file for all three virtual machines:
Vim / etc/hosts172.17.142.244 master172.17.142.244 etcd172.17.142.244 registry172.17.142.252 node1172.17.142.246 node2
Turn off the virtual machine firewall:
Step 2 of systemctl stop firewalldsystemctl disable firewalld: deploy the master node
The master node needs to install the following components:
Etcd
Flannel
Docker
Kubernets
Etcd installation installation etcd:
Yum install etcd-y
Modify the etcd configuration file:
Vim / etc/etcd/etcd.conf# [Member] # ETCD_CORS= "" ETCD_DATA_DIR= "/ var/lib/etcd/default.etcd" # ETCD_WAL_DIR= "" # ETCD_LISTEN_PEER_URLS= "http://localhost:2380"ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379, Http://0.0.0.0:4001"#ETCD_MAX_SNAPSHOTS="5"#ETCD_MAX_WALS="5"ETCD_NAME="master"#ETCD_SNAPSHOT_COUNT="100000"#ETCD_HEARTBEAT_INTERVAL="100"#ETCD_ELECTION_TIMEOUT="1000"#ETCD_QUOTA_BACKEND_BYTES="0"#ETCD_MAX_REQUEST_BYTES="1572864"#ETCD_GRPC_KEEPALIVE_MIN_TIME="5s"#ETCD_GRPC_KEEPALIVE_INTERVAL="2h0m0s"#ETCD_GRPC_KEEPALIVE_TIMEOUT=" 20s "# # [Clustering] # ETCD_INITIAL_ADVERTISE_PEER_URLS=" http://localhost:2380"ETCD_ADVERTISE_CLIENT_URLS="http://etcd:2379, Http://etcd:4001"#ETCD_DISCOVERY=""#ETCD_DISCOVERY_FALLBACK="proxy"#ETCD_DISCOVERY_PROXY=""#ETCD_DISCOVERY_SRV=""#ETCD_INITIAL_CLUSTER="default=http://localhost:2380"#ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"#ETCD_INITIAL_CLUSTER_STATE="new"#ETCD_STRICT_RECONFIG_CHECK="true"#ETCD_ENABLE_V2="true"##[Proxy]#ETCD_PROXY="off"#ETCD_PROXY_FAILURE_WAIT="5000 "# ETCD_PROXY_REFRESH_INTERVAL=" 30000 "# ETCD_PROXY_DIAL_TIMEOUT=" 1000 "# ETCD_PROXY_WRITE_TIMEOUT=" 5000 "# ETCD_PROXY_READ_TIMEOUT=" 0 "# # [Security] # ETCD_CERT_FILE="# ETCD_KEY_FILE=", # ETCD_CLIENT_CERT_AUTH= "false" # ETCD_TRUSTED_CA_FILE= "# ETCD_AUTO_TLS=" false "# ETCD_PEER_CERT_FILE="# ETCD_PEER_KEY_FILE="# ETCD_PEER _ CLIENT_CERT_AUTH= "false" # ETCD_PEER_TRUSTED_CA_FILE= "# ETCD_PEER_AUTO_TLS=" false "# # [Logging] # ETCD_DEBUG=" false "# ETCD_LOG_PACKAGE_LEVELS="# ETCD_LOG_OUTPUT=" default "# [Unsafe] # ETCD_FORCE_NEW_CLUSTER=" false "# [Version] # ETCD_VERSION=" false "# ETCD_AUTO_COMPACTION_RETENTION=" 0 "# [Profiling] # ETCD_ENABLE_PPROF=" false "# ETCD_METRICS= "basic" # # [Auth] # ETCD_AUTH_TOKEN= "simple"
Start the etcd service:
Systemctl start etcd
View etcd health status:
Etcdctl-C http://etcd:2379 cluster-healthetcdctl-C http://etcd:4001 cluster-health
Flannel installation commands:
Yum install flannel
Configure flannel:
Vim / etc/sysconfig/flanneld# Flanneld configuration options # etcd url location. Point this to the server where etcd runsFLANNEL_ETCD_ENDPOINTS= "http://etcd:2379"# etcd config key. This is the configuration key that flannel queries# For address range assignmentFLANNEL_ETCD_PREFIX= "/ atomic.io/network" # Any additional options that you want to pass#FLANNEL_OPTIONS= ""
Configure the key about flannel in etcd:
Etcdctl mk / atomic.io/network/config'{"Network": "10.0.0.0 Universe 16"}'
Start flanneld and set up boot:
Systemctl start flanneld.servicesystemctl enable flanneld.service
Docker install install docker and start, and set up boot:
Yum install docker-yservice docker startchkconfig docker on
Kubernets installation k8s:
Yum install kubernetes
Configuration / etc/kubernetes/apiserver file:
# kubernetes system config## The following values are used to configure the kube-apiserver## The address on the local server to listen to.KUBE_API_ADDRESS= "--address=0.0.0.0" # The port on the local server to listen on.KUBE_API_PORT= "--port=8080" # Port minions listen onKUBELET_PORT= "--kubelet-port=10250" # Comma separated list of nodes in the etcd clusterKUBE_ETCD_SERVERS= "- etcd-servers= http://etcd:2379"# Address range to use for servicesKUBE_SERVICE_ ADDRESSES= "--service-cluster-ip-range=10.254.0.0/16" # default admission control policies# KUBE_ADMISSION_CONTROL= "--admission-control=NamespaceLifecycle NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota "KUBE_ADMISSION_CONTROL="-- admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota "# Add your owning KUBE APISAGSs ="
Configuration / etc/kubernetes/config file
# kubernetes system config## The following values are used to configure various aspects of all# kubernetes services, including## kube-apiserver.service# kube-controller-manager.service# kube-scheduler.service# kubelet.service# kube-proxy.service# logging tostderr means we get it in the systemd journalKUBE_LOGTOSTDERR= "--logtostderr=true" # journal message level, 0 is debugKUBE_LOG_LEVEL= "--vault 0" # Should this cluster be allowed to run privileged docker containersKUBE_ALLOW_PRIV= "--allow-privileged=false" # How the controller-manager, scheduler And proxy find the apiserverKUBE_MASTER= "--master= http://master:8080"
Start the components of k8s:
Systemctl start kube-apiserver.servicesystemctl start kube-controller-manager.servicesystemctl start kube-scheduler.service
Set k8s components to boot:
Step 3 of systemctl enable kube-apiserver.servicesystemctl enable kube-controller-manager.servicesystemctl enable kube-scheduler.service: deploy the node node
The node node requires the following components to be installed:
Flannel
Docker
Kubernetes
Flannel installation commands:
Yum install flannel
Configure flannel:
Vim / etc/sysconfig/flanneld# Flanneld configuration options # etcd url location. Point this to the server where etcd runsFLANNEL_ETCD_ENDPOINTS= "http://etcd:2379"# etcd config key. This is the configuration key that flannel queries# For address range assignmentFLANNEL_ETCD_PREFIX= "/ atomic.io/network" # Any additional options that you want to pass#FLANNEL_OPTIONS= ""
Start flannel and set up boot:
Systemctl start flanneld.servicesystemctl enable flanneld.service
Docker install install docker and start, and set up boot:
Yum install docker-yservice docker startchkconfig docker on
Kubernetes installation commands:
Yum install kubernetes
Unlike the master node, the following components running kubernetes are required on the slave node:
* kubelet* kubernets-proxy
Configuration / etc/kubernetes/config:
Vim / etc/kubernetes/config#### kubernetes system config## The following values are used to configure various aspects of all# kubernetes services, including## kube-apiserver.service# kube-controller-manager.service# kube-scheduler.service# kubelet.service# kube-proxy.service# logging tostderr means we get it in the systemd journalKUBE_LOGTOSTDERR= "--logtostderr=true" # journal message level 0 is debugKUBE_LOG_LEVEL= "--master= 0" # Should this cluster be allowed to run privileged docker containersKUBE_ALLOW_PRIV= "--allow-privileged=false" # How the controller-manager, scheduler, and proxy find the apiserverKUBE_MASTER= "--master= http://master:8080"
Configuration / etc/kubernetes/kubelet:
Vim / etc/kubernetes/kubelet#### kubernetes kubelet (minion) config# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces) KUBELET_ADDRESS= "- address=0.0.0.0" # The port for the info server to serve onKUBELET_PORT= "- port=10250" # You may leave this blank to use the actual hostnameKUBELET_HOSTNAME= "- hostname-override=node1" # location of the api-serverKUBELET_API_SERVER= "- api-servers= http://master:8080"# Pod infrastructure containerKUBELET_POD_INFRA_CONTAINER= "- pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest" # Add your ownkeeper KUBELETLETRAGSs = ""
Start the kube service:
Systemctl start kubelet.servicesystemctl start kube-proxy.service
Set k8s components to boot automatically:
Systemctl enable kubelet.servicesystemctl enable kube-proxy.service
So far, the process of building the k8s cluster is complete. Let's verify whether the cluster has been built successfully.
Step 4: verify the status of the cluster
View endpoint information:
Kubectl get endpoints
View cluster information:
Kubectl cluster-info
This is the end of "how to install k8s cluster". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.