如何在Ubuntu上安装Kubernetes
单节点集群
MicroK8s只需几秒钟即可安装经CNCF认证的单节点Kubernetes集群
MicroK8s可以在任何Linux上运行。它轻巧,可以在Ubuntu上本地部署所有Kubernetes服务(即无需虚拟机),同时打包所需的全部库和二进制文件。由于其占地面积小,因此适用于笔记本电脑,工作站,CI管道,IoT设备和小型边缘云。
安装最新的MicroK8
MicroK8s被打包为一个快照,需要安装快照。最新的Ubuntu版本已经内置了该版本。对于其他Linux系统,请先安装snap。使用以下命令获取最新版本的MicroK8:
sudo snap install microk8s --classic
安装特定版本的MicroK8
列出特定的Kubernetes版本
以下命令将列出可以安装的所有MicroK8版本:
snap info microk8s
安装特定的Kubernetes版本
此命令将安装稳定的1.14版本的MicroK8:
sudo snap install microk8s --classic --channel=1.14/stable
有用的提示
此命令将安装稳定的1.14版本的MicroK8:
安装MicroK8s之后,您应该确认它已经准备就绪。使用此命令:
microk8s.status
要阻塞直到MicroK8准备就绪,请使用以下命令:
microk8s.status --wait-ready
访问Kubernetes: MicroK8嵌入了访问已安装的MicroK8所需的kubectl和.kubeconfig文件。这样可以避免与可能已经安装的任何本地版本冲突。这是如何使用此示例:
microk8s.kubectl
如果要在本地使用MicroK8s的kubectl和.kubeconfig文件,可以执行以下操作:
snap alias microk8s.kubectl kubectl
microk8s.kubectl config view --raw > $HOME/.kube/config
该MicroK8s安装上述指示是那些在发现的总结microk8s.io。
How to install Kubernetes on Ubuntu
Single node cluster
MicroK8s installs a single node, CNCF-certified Kubernetes cluster in seconds
MicroK8s is built to run on any Linux. It’s lightweight and deploys all Kubernetes services natively on Ubuntu (i.e. no virtual machines required) while packing the entire set of libraries and binaries needed. It’s suited for laptops, workstations, CI pipelines, IoT devices, and small edge clouds because of its small footprint.
Install latest MicroK8s
MicroK8s is packaged as a snap which requires snapd to be installed. The latest Ubuntu release comes with this already built in. For other Linux systems install snapd first. Use this command to get the latest version of MicroK8s:
sudo snap install microk8s --classic
Copy to clipboard
Install specific versions of MicroK8s
List specific Kubernetes versions
The following command will list all versions of MicroK8s that can be installed:
snap info microk8s
Copy to clipboard
Install specific Kubernetes version
This command will install the stable 1.14 version of MicroK8s:
sudo snap install microk8s --classic --channel=1.14/stable
Copy to clipboard
Useful tips
This command will install the stable 1.14 version of MicroK8s:
After installing MicroK8s, you should verify it is ready. Use this command:
microk8s.status
Copy to clipboard
To block until MicroK8s is ready, use the following command:
microk8s.status --wait-ready
Copy to clipboard
Accessing Kubernetes: MicroK8s embeds a kubectl and a .kubeconfig file required for accessing the installed MicroK8s. This avoids colliding with any local versions that might be already installed. Here is an example of how to use this:
microk8s.kubectl
Copy to clipboard
If you would like to use the MicroK8s kubectl and .kubeconfig file locally, you can do the following:
snap alias microk8s.kubectl kubectl
Copy to clipboard
microk8s.kubectl config view --raw > $HOME/.kube/config
Copy to clipboard
The MicroK8s install instructions above are a summary of those found at microk8s.io.
Full MicroK8s documentation
Multi node cluster
来源:CSDN
作者:muzhe/1024
链接:https://blog.csdn.net/muzhe1024/article/details/103968312