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

How to create a kubernetes cluster using the kubeadm command line tool

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

Share

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

This article mainly shows you "how to use kubeadm command-line tools to create kubernetes clusters", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use kubeadm command-line tools to create kubernetes clusters" this article.

Command line tool

There are three main tools, and command-line tools are named using the kube prefix.

Kubeadm: the instruction used to initialize the cluster.

Kubelet: used to launch Pod, containers, etc., on each node in the cluster.

Kubectl: a command-line tool for communicating with clusters.

Installed through a software repository

Method ①

This method is to download the installation kit from the source of Google.

Update the apt package index and install the packages required to use the Kubernetes apt repository:

Sudo apt-get updatesudo apt-get install-y apt-transport-https ca-certificates curl

Download the Google Cloud public signature key:

Sudo curl-fsSLo / usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

Add a Kubernetes apt repository:

Echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee / etc/apt/sources.list.d/kubernetes.list

Update the apt package index, install kubelet, kubeadm, and kubectl, and lock their versions:

Sudo apt-get updatesudo apt-get install-y kubelet kubeadm kubectlsudo apt-mark hold kubelet kubeadm kubectl

Method ②

Download the installation kit from Aliyun's source.

Add the source directly through the command.

Curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add

Then update the software source and install the three tools.

Apt-get update & & apt-get install-y apt-transport-https curlapt-get install-y kubelet kubeadm kubectl-allow-unauthenticated

Execute the command to check if it is normal:

Download and install kubeadm-help binaries

Check out the latest stable version of kubectl:

Curl-s https://storage.googleapis.com/kubernetes-release/release/stable.txt

The stable version currently queried by the author is v1.20.2.

Download the kubectl executable file to replace the version number in URL.

Curl-LO https://storage.googleapis.com/kubernetes-release/release/v1.20.2/bin/linux/amd64/kubectl

After downloading, the directory can see a kubectl file, 40MB size, the domestic download speed is slightly slower, may not be able to download, be prepared.

Then you need to give it executable file permissions.

Sudo chmod + x. / kubectl

In order to use kubectl directly, you can copy the files to the bin directory.

Sudo mv. / kubectl / usr/local/bin/kubectl

Execute the command to output the version number and check whether the installation is successful.

Kubectl version-client

Output:

Client Version: version.Info {Major: "1", Minor: "20", GitVersion: "v1.20.0", GitCommit: "af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState: "clean", BuildDate: "2020-12-08T17:59:43Z", GoVersion: "go1.15.5", Compiler: "gc", Platform: "linux/amd64"} ubutu & centos Quick installation

It's just that the different installation methods of ubuntu and centos are introduced here, which have been installed through the previous installation method, so you don't need to pay attention to this section.

Systems such as Ubuntu and Debain can be installed from the software repository using the following commands:

Sudo apt-get update & & sudo apt-get install-y apt-transport-https gnupg2 curlcurl-s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add-echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee-a / etc/apt/sources.list.d/kubernetes.listsudo apt-get updatesudo apt-get install-y kubelet kubeadm kubectl

Centos, RHEL and other systems can be installed through the software repository using the following commands:

Cat

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

Development

Wechat

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

12
Report