之前找了很多资料,要不就网络不通,要不步骤及其复杂,看的云里雾里。
经过实践,给大家总结最快的方法安装 Kubernetes
如果你之前使用过docker toolbox ,VirtualBox本来就有的,请忽略。
1、安装virtualbox5.2.22
https://www.virtualbox.org/wiki/Downloads
在上面的链接中下载windows版本的VirtualBox-5.2.22-126460-Win.exe,然后安装。
建立E:\k8s目录,下载minikube和kubectl,并配置path路径
(1)建立E:\k8s目录。
(2)下载minikube和kubectl软件。
下载:http://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v0.28.0/minikube-windows-amd64.exe?spm=a2c4e.11153940.blogcont221687.28.4ffc7733NjbciY&file=minikube-windows-amd64.exe
重命名为minikube.exe,并拷贝到e:\k8s目录。
下载https://storage.googleapis.com/kubernetes-release/release/v1.10.2/bin/windows/amd64/kubectl.exe,并拷贝到e:\k8s目录。
(3)配置windows的path路径
将e:\k8s配置到windows的path环境变量中。
验证:
win+R(打开cmd窗口)
$ minikube version
minikube version: v0.28.0
执行minikube 命令,第一次执行会下载Linux虚拟机和部分组件,在本机搭建kubernetes,
>minikube start
There is a newer version of minikube available (v1.2.0). Download it here:
https://github.com/kubernetes/minikube/releases/tag/v1.2.0
To disable this notification, run the following:
minikube config set WantUpdateNotification false
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
153.08 MB / 153.08 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Finished Downloading kubelet v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.
1.执行命令minikube status,查看kubernetes的状态
minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.101
2.执行minikube ssh,登录kubernetes的linux虚拟机。
minikube ssh
也可以使用xshell 登陆
使用用户:docker,密码:tcuser登录。比如:
ssh [email protected],然后输入密码
Connecting to 192.168.99.101:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ ` _ `\| |/' _ `\| || , < ( ) ( )| '_`\ /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)
3.行命令kubectl get nodes,查看kubernetes节点状态
kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 27m v1.10.0
4.访问集群管理页面
minikube dashboard
Opening kubernetes dashboard in default browser...