Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
Kubernetes官网地址https://kubernetes.io/
但是,进入首页后依然会很懵逼,进入Documentation页面会更懵逼,对于初学者想依照文档搭建个环境try一下相当费劲,太乱了,下面我会整理下相关步骤以及文档地址。
kubernetes运行环境选择
官方说明:https://kubernetes.io/docs/setup/pick-right-solution/
Kubernetes can run on various platforms: from your laptop, to VMs on a cloud provider, to rack of bare metal servers. The effort required to set up a cluster varies from running a single command to crafting your own customized cluster. Use this guide to choose a solution that fits your needs.
- Local-machine Solutions
just want to “kick the tires” on Kubernetes - Hosted Solutions
ready to scale up to more machines and higher availability - Turnkey Cloud Solutions
you already have a way to configure hosting resources - Custom Solutions
这里我们选择最简单的Local-machine Solutions模式。
我是Mac环境,会以mac为主,单操作步骤也会说明其他环境如何安装。
在minikube上运行Local-machine Solutions模式
官网说明:https://kubernetes.io/docs/getting-started-guides/minikube/
官方说明会要求你先安装minikube,安装minikube说明在
https://kubernetes.io/docs/tasks/tools/install-minikube/,这里会要求先安装Hypervisor
安装Hypervisor
我选择的是OS X的第二个选项,VirtualBox,因为这个下载下来直接就是一个dmg文件,方便安装 VirtualBox-5.1.26-117224-OSX.dmg,94M。
安装后启动
红框内是因为我启动过本地的minikube,刚安装好时是没有的。
安装kubectl
官方说明:https://kubernetes.io/docs/tasks/tools/install-kubectl/
根据环境选择不同页签哦。
我选择macos命令行输入 curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.7.0/bin/darwin/amd64/kubectl
下载完成后,执行chmod +x ./kubectl,保证其执行权限
将包移动至类路径下
sudo mv ./kubectl /usr/local/bin/kubectl
到此,kubectl就安装完成了,这页官网剩下的内容可以忽略或简单看下即可了。
安装Minikube
现在才开始真正安装Minikube
地址:https://github.com/kubernetes/minikube/releases
Windows安装包在这一页也是可以找到的,往下翻即可。
我选择OSX
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.21.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
好了,minikube安装好了,需要的安装包基本都已ok啦。
现在可以开始配置了。
配置
依次执行如下5个步骤
bjjbgi-3-86:~ zhangxiaolong$ minikube start
Starting local Kubernetes v1.7.0 cluster...
Starting VM...
Downloading Minikube ISO
97.80 MB / 97.80 MB [==============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster.
bjjbgi-3-86:~ zhangxiaolong$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8082 deployment "hello-minikube" created
deployment "hello-minikube" created
bjjbgi-3-86:~ zhangxiaolong$ kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed
bjjbgi-3-86:~ zhangxiaolong

最低0.47元/天 解锁文章
3959

被折叠的 条评论
为什么被折叠?



