天天看點

用minikube運作一個本地單節點Kubernetes叢集

* 安裝Minikube

mac:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.23.0/minikube-darwin-amd64
           

linux:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.23.0/minikube-linux-amd64

chmod a+x minikube
sudo cp minikube /usr/local/bin/
           

wget http://47.93.27.106/share/minikube.mac

* 使用minikube啟動一個kubernetes叢集

minikube start
           

========================================

kubectl could not be found on your path. kubectl is a requirement for using minikube

To install kubectl, please run the following:

curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/

To disable this message, run the following:

minikube config set WantKubectlDownloadMsg false

========================================

Starting local Kubernetes v1.8.0 cluster...

Starting VM...

E0310 15:40:41.822355    7185 start.go:150] Error starting host: Error creating host: Error executing step: Running precreate checks.

: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path.

 Retrying.

E0310 15:40:41.822851    7185 start.go:156] Error starting host:  Error creating host: Error executing step: Running precreate checks.

: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path

* 安裝kubernetes

cd $GOPATH/src/k8s.io/
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make
cd $GOPATH/src/k8s.io/kubernetes/cmd/kubectl
go build
go install
which kubectl
           

/opt/go/1.12/bin/kubectl

* docker重裝, 安裝 kubernetes

sudo yum erase docker-ce
sudo yum install kubernetes
which kubectl
           

/usr/bin/kubectl

* VirtualBox虛拟機下載下傳

https://www.virtualbox.org/wiki/Linux_Downloads

wget https://download.virtualbox.org/virtualbox/6.0.4/VirtualBox-6.0-6.0.4_128413_el7-1.x86_64.rpm
sudo yum install VirtualBox-6.0-6.0.4_128413_el7-1.x86_64.rpm
           

* 重試 啟動一個minikube虛拟機

minikube start
           

Starting local Kubernetes v1.8.0 cluster...

Starting VM...

Getting VM IP address...

Moving files into cluster...

E0310 15:54:21.734335   17579 start.go:222] Error updating cluster:  Error updating localkube from uri: Error attempting to download and cache localkube: Error getting localkube download url: Error getting valid localkube versions: Error getting the localkube versions: Error getting json via http with url: https://storage.googleapis.com/minikube/k8s_releases.json: Error getting json from url: https://storage.googleapis.com/minikube/k8s_releases.json via http: Get https://storage.googleapis.com/minikube/k8s_releases.json: dial tcp 172.217.163.240:443: i/o timeout

================================================================================

An error has occurred. Would you like to opt in to sending anonymized crash

information to minikube to help prevent future errors?

To opt out of these messages, run the command:

minikube config set WantReportErrorPrompt false

================================================================================

Please enter your response [Y/n]: Y

ISSUE:

1. 網絡不通?

CentOS下shadowsock服務端搭建及用戶端全局http代理的實作

https://blog.51cto.com/11975865/2308030

2. This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory.

在真實機器上做, 不能在雲主機上搞.

用minikube運作一個本地單節點Kubernetes叢集

* 使用kubectl檢視叢集是否正常工作

$ kubectl cluster-info

Kubernetes master is running at https://192.168.99.100:8443

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

** 可以運作minikube ssh登入到Minikube VM并從内部探索它

$ minikube ssh

用minikube運作一個本地單節點Kubernetes叢集

代碼以及指令行下載下傳

git clone git://github.com/luksa/kubernetes-in-action

繼續閱讀