YUM warehouse online simple installation single node K8S (pure combat)

Posted by Carlo Gambino on Tue, 04 Feb 2020 18:33:54 +0100

Simple online installation of single node K8S using YUM warehouse

Experimental environment:

Using system: CentOS 7.4

Name role IP address
centos7-min2 master
centos7-4 node

Experimental steps:

1, Configuration step directory

master configuration

node configuration

Test results

2, master configuration

Use yum warehouse to install atcd database, kubernetes component and flannel network component

[root@master ~]# yum install -y etcd kubernetes flannel

Modify etcd configuration file

[root@master ~]# vim /etc/etcd/etcd.conf
//Modify according to the figure below
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"                      //Data file storage path
ETCD_LISTEN_CLIENT_URLS=" "/ / address of external service
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379 "/ / listening address of the client of this node

Modify the apiserver configuration file

[root@master ~]# vim /etc/kubernetes/apiserver
//Modify according to the figure below
KUBE_API_ADDRESS="--address="                //Listening interface
KUBE_API_PORT="--port=8080"                           //Listening port of apiserver
KUBELET_PORT="--kubelet-port=10250"                    //Port on which kubelet listens
KUBE_ETCD_SERVERS="--etcd-servers= "/ / specify the service address and port of ETCD
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range="                 //ip address range that kubernetes can assign
KUBE_API_ARGS=""                     //Additional configuration items are needed to simply enable a cluster without configuration

Configure the flannel network

[root@localhost sysconfig]# vim /etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS=" "/ / fill in the local address

Start all services

[root@localhost sysconfig]# for server in etcd kube-apiserver kube-controller-manager kube-scheduler;do systemctl restart $server;systemctl enable $server;systemctl status $server;done
//I believe you can understand the for loop used here for batch startup

Setting up etcd database

[root@localhost sysconfig]# etcdctl -C // set /coreos.com/network/comfig '{"Network":""}'

3, node configuration

Install the components of flannel and kubernetes

[root@node ~]# yum -y install flannel kubernetes

Modify kubernetes configuration file

[root@node ~]# vim /etc/kubernetes/config
//Modify as follows
KUBE_MASTER="--master= "/ / point to the master address and the port is the apiserver listening port
KUBE_ETCD_SERVERS="--etcd_servers= "/ / point to etcd server address

Modify kubelet configuration file

[root@node ~]# vim /etc/kubernetes/kubelet
//Modify as follows
KUBELET_ADDRESS="--address="                     //Monitor the whole network segment
KUBELET_PORT="--port=10250"               //Port remains unchanged
KUBELET_HOSTNAME="--hostname-override="                 //Refer to oneself
KUBELET_API_SERVER="--api-servers= "/ / point to the master

Modify the flannel network configuration

[root@node ~]# vim /etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS=" "/ / point to the primary server

Turn on all components

[root@node ~]# for SERVICES in flanneld kube-proxy kubelet docker; do systemctl restart $SERVICES; systemctl enable $SERVICES; systemctl status $SERVICES; done

4, Test results

Return to master

[root@master sysconfig]# kubectl get nodes
NAME             STATUS    AGE   Ready     34m

Be careful:

Using YUM warehouse to install K8S online is usually only suitable for the experimental environment, and the fault tolerance is too poor.

Topics: Linux Kubernetes network vim yum