单机部署
创建Kubernetes cluster(单机版)最简单的方法是minikube:
首先下载kubectl
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.6.4/bin/linux/amd64/kubectl
- chmod +x kubectl
安装minikube
- # install minikube
- $ brew cask install minikube
- $ brew install docker-machine-driver-xhyve
- # docker-machine-driver-xhyve need root owner and uid
- $ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
- $ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
最后启动minikube
- # start minikube.
- # http proxy is required in China
- $ minikube start --docker-env HTTP_PROXY=http://proxy-ip:port --docker-env HTTPS_PROXY=http://proxy-ip:port --vm-driver=xhyve
开发版
minikube/localkube只提供了正式release版本,而如果想要部署master或者开发版的话,则可以用hack/local-up-cluster.sh来启动一个本地集群:
- cd $GOPATH/src/k8s.io/kubernetes
- export KUBERNETES_PROVIDER=local
- hack/install-etcd.sh
- export PATH=$GOPATH/src/k8s.io/kubernetes/third_party/etcd:$PATH
- hack/local-up-cluster.sh
打开另外一个终端,配置kubectl:
cd $GOPATH/src/k8s.io/kubernetes
export KUBECONFIG=/var/run/kubernetes/admin.kubeconfig
cluster/kubectl.sh