k8s installation tutorial, CentOS 7.5, ARM architecture server (Feiteng platform)

1 installation environment [root@k8s-master ~]# uname -a Linux k8s-master 4.14.0-49.12.ts7.aarch64 #1 SMP Tue Nov 12 19:...
1 installation environment
[root@k8s-master ~]# uname -a Linux k8s-master 4.14.0-49.12.ts7.aarch64 #1 SMP Tue Nov 12 19:06:54 CST 2019 aarch64 aarch64 aarch64 GNU/Linux [root@k8s-master ~]# cat /etc/redhat-release TongyuanOS release 7.5.1810
host IP function k8s-master 192.168.0.239 Master k8s-node1 192.168.0.244 node 2. Modify the hosts files of the master and node
[root@k8s-master ~]# vim /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 10.2.152.78 k8s-master 10.2.152.72 k8s-node1
3. Install ntp to realize time synchronization among all servers
[root@k8s-master ~]# yum install ntp -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * epel: mirrors.tuna.tsinghua.edu.cn file:///mnt/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/repodata/repomd.xml" Trying other mirror. Package ntp-4.2.6p5-28.ts7.aarch64 already installed and latest version Nothing to do
[root@k8s-master ~]# vim /etc/ntp.conf # For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict ::1 # Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 192.168.0.244 iburst #server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst #broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 autokey # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 autokey # manycast client # Enable public key cryptography. #crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating # with symmetric key cryptography. keys /etc/ntp/keys # Specify the key identifiers which are trusted. #trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility. #requestkey 8 # Specify the key identifier to use with the ntpq utility. #controlkey 8 # Enable writing of statistics records. #statistics clockstats cryptostats loopstats peerstats # Disable the monitoring facility to prevent amplification attacks using ntpdc # monlist command when default restrict does not include the noquery flag. See # CVE-2013-5211 for more details. # Note: Monitoring will not be disabled with the limited restriction flag. disable monitor [root@k8s-master ~]#
4. Turn off the firewall and selinux of the master and node
[root@k8s-master ~]# systemctl stop firewalld [root@k8s-master ~]# systemctl disable firewalld [root@k8s-master ~]# vim /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted [root@k8s-master ~]# reboot

The main view is SELINUX=disabled. If SELinux = enabled needs to be modified to disabled

Install docker on 5master and node Install dependency package
yum install -y yum-utils device-mapper-persistent-data lvm2
Add the yum source of docker package
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Close the test version list (only stable version is displayed)
yum-config-manager --enable docker-ce-edge yum-config-manager --enable docker-ce-test
Update yum package index
yum makecache fast
Install docker Install docker CE directly
yum install docker-ce
Install the specified version of Docker CE
yum list docker-ce --showduplicates|sort -r #Find what needs to be installed yum install docker-ce-18.06.0.ce -y #Start docker systemctl start docker & systemctl enable docker
Error
Transaction check error: file /usr/bin/docker from install of docker-ce-18.06.0.ce-3.el7.centos.aarch64 conflicts with file from package docker-ce-cli-1:18.09.7-3.el7.aarch64 file /usr/share/bash-completion/completions/docker from install of docker-ce-18.06.0.ce-3.el7.centos.aarch64 conflicts with file from package docker-ce-cli-1:18.09.7-3.el7.aarch64 file /usr/share/man/man1/docker-attach.1.gz from install of docker-ce-18.06.0.ce-3.el7.centos.aarch64 conflicts with file from package docker-ce-cli-1:18.09.7-3.el7.aarch64

Uninstall the old version of docker package

yum erase docker-ce-cli-1:18.09.7-3.el7.aarch64

Reinstall docker

Error

After installing docker, use "docker version" to view the docker version report:

Cannot connect to the Docker daemon at tcp://0.0.0.0:2375. Is the docker daemon running?

Solution: configure DOCKER_HOST

vim /etc/profile.d/docker.sh #Add content export DOCKER_HOST=tcp://localhost:2375 #Execute application command after saving source /etc/profile #Configure startup files vim /lib/systemd/system/docker.service #take ExecStart=/usr/bin/dockerd #Change to ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:7654 # Note: 2375 is the management port; 7654 is the standby port # Reload configuration and restart systemctl daemon-reload systemctl restart docker.service

Execute "docker version" again to view the docker program.

k8s installed on master and node Change yum source to Ali source
vim /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-aarch64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg exclude=kube*
yum install k8s
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes #Or specified version installation yum install -y kubelet-1.15.2 kubeadm-1.15.2 kubectl-1.15.2 --disableexcludes=kubernetes
Start k8s service
systemctl enable kubelet && systemctl start kubelet
View version number
kubeadm version kubeadm version: &version.Info
Configure iptable
vim /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 vm.swappiness=0 #Execute after saving sysctl --system
Turn off swap
swapoff -a #To permanently disable the swap partition, open the following file and comment out the swap line vi /etc/sta
Install etcd and flannel (etcd+flannel is installed on the master, only flannel is installed on the node)
yum -y install etcd systemctl start etcd;systemctl enable etc yum -y install flannel
Initialize image on master
kubeadm init --kubernetes-version=v1.15.2 --pod-network-cidr=10.2.0.0/16 --apiserver-advertise-address=192.168.0.239 [init] Using Kubernetes version: v1.15.2 [preflight] Running pre-flight checks [preflight] Pulling images required for setting up a Kubernetes cluster [preflight] This might take a minute or two, depending on the speed of your internet connection [preflight] You can also perform this action in beforehand using 'kubeadm config images pull' [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Activating the kubelet service [certs] Using certificateDir folder "/etc/kubernetes/pki" [certs] Generating "etcd/ca" certificate and key [certs] Generating "etcd/server" certificate and key [certs] etcd/server serving cert is signed for DNS names [k8s-master localhost] and IPs [192.168.0.239 127.0.0.1 ::1] [certs] Generating "apiserver-etcd-client" certificate and key [certs] Generating "etcd/peer" certificate and key [certs] etcd/peer serving cert is signed for DNS names [k8s-master localhost] and IPs [192.168.0.239 127.0.0.1 ::1] [certs] Generating "etcd/healthcheck-client" certificate and key [certs] Generating "ca" certificate and key [certs] Generating "apiserver" certificate and key [certs] apiserver serving cert is signed for DNS names [k8s-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.0.239] [certs] Generating "apiserver-kubelet-client" certificate and key [certs] Generating "front-proxy-ca" certificate and key [certs] Generating "front-proxy-client" certificate and key [certs] Generating "sa" key and public key [kubeconfig] Using kubeconfig folder "/etc/kubernetes" [kubeconfig] Writing "admin.conf" kubeconfig file [kubeconfig] Writing "kubelet.conf" kubeconfig file [kubeconfig] Writing "controller-manager.conf" kubeconfig file [kubeconfig] Writing "scheduler.conf" kubeconfig file [control-plane] Using manifest folder "/etc/kubernetes/manifests" [control-plane] Creating static Pod manifest for "kube-apiserver" [control-plane] Creating static Pod manifest for "kube-controller-manager" [control-plane] Creating static Pod manifest for "kube-scheduler" [etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests" [wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s [apiclient] All control plane components are healthy after 32.003346 seconds [upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace [kubelet] Creating a ConfigMap "kubelet-config-1.15" in namespace kube-system with the configuration for the kubelets in the cluster [upload-certs] Skipping phase. Please see --upload-certs [mark-control-plane] Marking the node k8s-master as control-plane by adding the label "node-role.kubernetes.io/master=''" [mark-control-plane] Marking the node k8s-master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule] [bootstrap-token] Using token: r0y84o.kcmv4dumghku67cj [bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles [bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials [bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token [bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster [bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace [addons] Applied essential addon: CoreDNS [addons] Applied essential addon: kube-proxy Your Kubernetes control-plane has initialized successfully! To start using your cluster, you need to run the following as a regular user: mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/ Then you can join any number of worker nodes by running the following on each as root: kubeadm join 192.168.0.239:6443 --token r0y84o.kcmv4dumghku67cj \ --discovery-token-ca-cert-hash sha256:e09ecb1421e7370c473b8ac56d1f6a993afafdb9c27729e4889422781d3c51d3 [root@k8s-master ~]#

If you cannot pull the image during execution, please manually pull the image of arm64 version

docker pull mirrorgcrio/kube-apiserver-arm64:v1.15.2 docker pull mirrorgcrio/kube-controller-manager-arm64:v1.15.2 docker pull mirrorgcrio/kube-scheduler-arm64:v1.15.2 docker pull mirrorgcrio/kube-proxy-arm64:v1.15.2 docker pull mirrorgcrio/etcd-arm64:3.3.10 docker pull mirrorgcrio/pause-arm64:3.1 docker pull quay-mirror.qiniu.com/coreos/flannel:v0.11.0-arm64

Execution output;

mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config

The cluster master node is installed successfully. Remember to save this command so that each node can join the cluster later:
You can now join any number of machines by running the following on each node
as root:

kubeadm join 192.168.0.239:6443 --token r0y84o.kcmv4dumghku67cj \ --discovery-token-ca-cert-hash sha256:e09ecb1421e7370c473b8ac56d1f6a993afafdb9c27729e4889422781d3c51d3
Configure kubeta authentication information
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile source ~/.bash_profile //or export KUBECONFIG=/etc/kubernetes/admin.conf source ~/.bash_profile

Check the cluster status and make sure that all components are in healthy status:

kubectl get cs NAME STATUS MESSAGE ERROR controller-manager Healthy ok scheduler Healthy ok etcd-0 Healthy {"health":"true"}
Configure the flannel network
kdir -p ~/k8s/ cd ~/k8s wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml kubectl apply -f kube-flannel.yml

If https://raw.githubusercontent.com Can't access please use:
https://site.ip138.com/raw.Githubusercontent.com/ input raw.githubusercontent.com Query IP address
Modify hosts Ubuntu, CentOS and Mac OS to input directly in the terminal

sudo vi /etc/hosts 151.101.76.133 raw.githubusercontent.com

The result of executing the command is:

kubectl apply -f kube-flannel.yml podsecuritypolicy.policy/psp.flannel.unprivileged created clusterrole.rbac.authorization.k8s.io/flannel created clusterrolebinding.rbac.authorization.k8s.io/flannel created serviceaccount/flannel created configmap/kube-flannel-cfg created daemonset.apps/kube-flannel-ds-amd64 created daemonset.apps/kube-flannel-ds-arm64 created daemonset.apps/kube-flannel-ds-arm created daemonset.apps/kube-flannel-ds-ppc64le created daemonset.apps/kube-flannel-ds-s390x created

29 May 2020, 10:11 | Views: 6357

Add new comment

For adding a comment, please log in
or create account

0 comments