安装成功后结果
root@node1:~# minikube start
Starting local Kubernetes v1.7.5 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
root@node1:~# virsh list --all
Id Name State
----------------------------------------------------
1 minikube running
virsh list --all
Id Name State
----------------------------------------------------
1 minikube running
参考:
https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm-driver
apt-get install libvirt-bin qemu-kvm -y
usermod -a -G libvirt $(whoami)
newgrp libvirt
apt-get install qemu-kvm qemu-system libvirt-bin bridge-utils -y
apt-get install virt-manager -y
参考:https://github.com/kubernetes/minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.22.2/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl && mv ./kubectl /usr/local/bin/kubectl
注:v0.22.2现在好像minikubev0.22.3了.
参考:https://github.com/dhiltgen/docker-machine-kvm
https://github.com/dhiltgen/docker-machine-kvm/releases
https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.10.0/docker-machine-driver-kvm-ubuntu16.04
注: 我on个的Ubuntu17.06,这里二进制包依旧用u16的.
注:关于以上二进制安装,包放在/usr/local/bin.并+x
minikube config set vm-driver kvm
支持安装完毕,minikube start即可.
cp /etc/apt/sources.list /etc/apt/sources.list_backup
cat >> /etc/apt/sources.list <<EOF
deb http://mirrors.163.com/ubuntu/ zesty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ zesty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ zesty-backports main restricted universe multiverse
EOF
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-get update
apt-get install docker-ce -y
版本可以搞成最新的,我下面的有点老了
$ docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/kube-addon-manager-amd64:v6.3
$ docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/kube-addon-manager-amd64:v6.3 gcr.io/google-containers/kube-addon-manager:v6.3
$ docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.1
$ docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/kubernetes-dashboard-amd64:v1.5.1 gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.1
$ docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kubedns-amd64:1.9
$ ocker tag registry.cn-hangzhou.aliyuncs.com/google-containers/kubedns-amd64:1.9 gcr.io/google_containers/kubedns-amd64:1.9
$ docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/kube-dnsmasq-amd64:1.4
$ docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/kube-dnsmasq-amd64:1.4 gcr.io/google_containers/kube-dnsmasq-amd64:1.4
$ docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/exechealthz-amd64:1.2
$ docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/exechealthz-amd64:1.2 gcr.io/google_containers/exechealthz-amd64:1.2
$ docker pull registry.cn-hangzhou.aliyuncs.com/google-container/echoserver:1.4
$ docker tag registry.cn-hangzhou.aliyuncs.com/google-container/echoserver:1.4 gcr.io/google_containers/echoserver:1.4
$ docker pull registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0
$ docker tag registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0 gcr.io/google_containers/pause-amd64:3.0
$ minikube status #查看minikube的状态
$ minikube stop #关闭cluster
$ minikube delete #删除集群
$ minikube dashboard #minikube自带dashboard,开启命令
启动一个echoserver pod
$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
通过NodePort暴露的服务
$ kubectl expose deployment hello-minikube --type=NodePort
检查pod是否启动并运行
$ kubectl get pod
通过curl测试服务是否可访问
$ curl $(minikube service hello-minikube --url)
更多minikube命令
https://kubernetes.io/docs/getting-started-guides/minikube/
kvm手头命令
http://blog.csdn.net/wh211212/article/details/74908390
https://github.com/coreos/minikube-iso/releases/
minikube start \
--iso-url=file:///root/minikube-v0.0.5.iso \
--kubernetes-version v1.7.5