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

CentOS7.2 detailed steps for installing Kubernetes1.03

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

Share

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

This article introduces the relevant knowledge of "the detailed steps of installing Kubernetes1.03 in CentOS7.2". Many people will encounter such a dilemma in the operation of actual cases, 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!

As of September 1, 2015, CentOS has added Kubernetes to the official source, so it is much easier to install Kubernetes now.

The versions of each component are as follows:

Kubernetes-1.03docker-1.8.2flannel-0.5.3etcd-2.1.1

The Kubernetes deployment environment roles are as follows:

CentOS 7.264-bit system, 3 virtual machines: master:192.168.32.15minion1:192.168.32.16minion2:192.168.32.17

1. Pretreatment

Disable iptables per machine to avoid conflicts with docker's iptables:

Systemctl stop firewalldsystemctl disable firewalld

Disable selinux:

Vim / etc/selinux/config#SELINUX=enforcingSELINUX=disabled

Install docker on 2 minions machines:

Yum-y install dockeryum-y updatereboot

In the CentOS system, devicemapper is used as the storage backend. Loopback will be used in the initial installation of docker, which causes docker to start up with an error and needs to be started after update.

Docker startup script update

Vim / etc/sysconfig/docker

Add:-H tcp://0.0.0.0:2375, finally configured as follows to provide remote API maintenance later:

OPTIONS=--selinux-enabled-H tcp://0.0.0.0:2375-H fd://

Note in advance that when kubernetes runs pods, you need to run an image called pause. You need to download this image from docker.io, and then use the docker command to change the name:

Docker pull docker.io/kubernetes/pausedocker tag kubernetes/pause gcr.io/google_containers/pause:0.8.0docker tag gcr.io/google_containers/pause:0.8.0 gcr.io/google_containers/pause

2. Installation and configuration of master nodes

Install etcd and kubernetes-master:

Yum-y install etcd kubernetes-master

Modify the etcd configuration file:

# egrep-v "^ #" / etc/etcd/etcd.confETCD_NAME=defaultETCD_DATA_DIR= "/ var/lib/etcd/default.etcd" ETCD_LISTEN_CLIENT_URLS= "http://0.0.0.0:2379"ETCD_ADVERTISE_CLIENT_URLS="http://192.168.32.15:2379"

Modify the kube-master configuration file:

# egrep-v'^ #'/ etc/kubernetes/apiserver | grep-v'^ $'KUBE_API_ADDRESS= "--address=0.0.0.0" KUBE_ETCD_SERVERS= "--etcd_servers= http://192.168.32.15:2379"KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"KUBE_ADMISSION_CONTROL="--admission_control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount, ResourceQuota "KUBE_API_ARGS="# egrep-v'^ #'/ etc/kubernetes/controller-manager | grep-v'^ $'KUBE_CONTROLLER_MANAGER_ARGS="-- node-monitor-grace-period=10s-- pod-eviction-timeout=10s "[root@localhost ~] # egrep-v' ^ #'/ etc/kubernetes/config | egrep-v'^ $'KUBE_LOGTOSTDERR="-- logtostderr=true "KUBE_LOG_LEVEL="-- vroom0 "KUBE_ALLOW_PRIV="-- allow_privileged=false "KUBE_MASTER="- -master= http://192.168.32.15:8080"

Start the service:

Systemctl enable etcd kube-apiserver kube-scheduler kube-controller-managersystemctl start etcd kube-apiserver kube-scheduler kube-controller-manager

Define the flannel network configuration to etcd, which is pushed to the flannel service of each minions:

Etcdctl mk / coreos.com/network/config'{"Network": "172.17.0.0 Universe 16"}'

3. Installation and configuration of minion nodes

Yum-y install kubernetes-node flannel

Modify the kube-node and flannel configuration files:

# egrep-v'^ #'/ etc/kubernetes/config | grep-v'^ $'KUBE_LOGTOSTDERR= "--logtostderr=true" KUBE_LOG_LEVEL= "--vici0" KUBE_ALLOW_PRIV= "--allow_privileged=false" KUBE_MASTER= "--master= http://192.168.32.15:8080"# egrep-v' ^ #'/ etc/kubernetes/kubelet | grep-v'^ $'KUBELET_ADDRESS="-- address=127.0.0.1 "KUBELET_HOSTNAME="-- hostname_override=192.168. 32.16 "KUBELET_API_SERVER="-api_servers= http://192.168.32.15:8080"KUBELET_ARGS="--pod-infra-container-image=kubernetes/pause"

Configure flannel for the etcd service, modify the configuration file / etc/sysconfig/flanneld:

FLANNEL_ETCD= "http://192.168.32.15:2379"FLANNEL_ETCD_KEY="/coreos.com/network"

Start the service:

Systemctl enable flanenld kubelet kube-proxysystemctl restart flanneld dockersystemctl start kubelet kube-proxy

In each minions, you can see two network cards: docker0 and flannel0. The ip of these two network cards is different on different machines:

# minion14: flannel0: mtu 1472 qdisc pfifo_fast state UNKNOWN qlen 500 link/none inet 172.17.98.0/16 scope global flannel0 valid_lft forever preferred_lft forever5: docker0: mtu 1500 qdisc noqueue state DOWN link/ether 02:42:9a:01:ca:99 brd ff:ff:ff:ff:ff:ff inet 172.17.98.1/24 scope global docker0 valid_lft forever preferred_lft forever#minion24: flannel0: mtu 1472 qdisc pfifo_ Fast state UNKNOWN qlen 500 link/none inet 172.17.67.0/16 scope global flannel0 valid_lft forever preferred_lft forever5: docker0: mtu 1500 qdisc noqueue state DOWN link/ether 02:42:25:be:ba:64 brd ff:ff:ff:ff:ff:ff inet 172.17.67.1/24 scope global docker0 valid_lft forever preferred_lft forever

4. Check statu

Log in to master and confirm the status of minions:

This is the end of [root@master ~] # kubectl get nodesNAME LABELS STATUS192.168.32.16 kubernetes.io/hostname=192.168.32.16 Ready192.168.32.17 kubernetes.io/hostname=192.168.32.17 Ready "detailed steps for installing Kubernetes1.03 in CentOS7.2". 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.

Share To

Servers

Wechat

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

12
Report