Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to build a K8s cluster

Shulou Source: shulou.com Published: 2022-05-31 19:32:46 09月21日 Update

How to build a K8s cluster, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

In the off-the-shelf kubernetes environment that the company has been using, there are a lot of packaged components. This time I tried to build a lightweight environment by myself, and I stepped on a lot of holes. Pre-requirements: two hosts, such as CVM and virtual machine, should be interconnected with each other, and the memory should be larger than 2GB. Docker should be installed on the host in advance.

The two mainframes I use below.

Hostname (centos) ip role guozhao-50192.168.9.50Masterguozhao-51192.168.9.51slave

Building process

1. First configure the Ali cloud image source address on the two hosts

# enter the root user sudo su # configure the image address cat / dev/null | openssl dgst-sha256-hex | sed's / ^. * / /'

Execute kubeadm join on slave

Sudo su # enter root user kubeadm join\ # master-ip:port is the ip and port of the kubeconfig file-- token\ # previous step token--discovery-token-ca-cert-hash sha256:# previous step hash

View terminal

Note: if you encounter the following figure error, execute the command echo "1" > / proc/sys/net/bridge/bridge-nf-call-iptables

9. Use kubeconfig on the node node

Copy the kubeconfig file of the master node to the ~ / .kube of the ordinary user of the slave node

10. Check the node status # the node node NotReady may appear at the beginning, and it will become Ready kubectl get node when the image is pulled.

At this time, the one-master-one-slave k8s cluster has been built. Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Hosts nodes clusters commands users images addresses files networks errors previous normal plug-ins environments components problems Ali preparation help generation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology NVidia Shulou Information MariaDB Docker