需要本地验证部署一下knative,需要一个集群,所以先部署一个minikube。记录如下:
0.环境准备
安装一个VM VirtualBox 6.0.4版本。
1.安装Docker
自己的机器安装的是Linux Mint 18.3(ubuntu1604)。直接检查一下Docker等的安装情况。
$ docker --version
Docker version 18.09.4, build d14af54
如果没装,可以安装:sudo apt-get install docker.io
在修改一下仓库地址,避免到国外去下载,现在国内的镜像仓库也很多了。
# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
重启生效
sudo /etc/init.d/docker restart
2.安装kubectl
直接下一个编译好的包(https://github.com/kubernetes/kubernetes/releases)解压放入/usr/local/bin目录。
$ ll /usr/local/bin/kubectl
-rwxr-xr-x 1 root root 43103040 Mar 28 17:54 /usr/local/bin/kubectl*
3.安装minikube
发现阿里的minikube版本,应该是直接指向国内的库了,所以避免了网络墙的问题,直接去https://github.com/AliyunContainerService/minikube下载,并放入/usr/local/bin目录。
$ ll /usr/local/bin/minikube
-rwxr-xr-x 1 root root 40095660 Mar 28 17:53 /usr/local/bin/minikube*
启动、启动dashboard、停止等,虚拟机的数据等都存储在~/.minikube目录下。
minikube start --registry-mirror=https://registry.docker-cn.com
minikube dashboard
minikube stop
启动的时候提示如下:
$ minikube start --registry-mirror=https://registry.docker-cn.com
There is a newer version of minikube available (v1.0.0). Download it here:
https://github.com/kubernetes/minikube/releases/tag/v1.0.0
To disable this notification, run the following:
minikube config set WantUpdateNotification false
o minikube v0.35.0 on linux (amd64)
i Tip: Use 'minikube start -p
' to create a new cluster, or 'minikube delete' to delete this one. : Restarting existing virtualbox VM for "minikube" ...
: Waiting for SSH access ...
- "minikube" IP address is 192.168.99.103
- Configuring Docker as the container runtime ...
- Preparing Kubernetes environment ...
- Pulling images required by Kubernetes v1.13.4 ...
: Relaunching Kubernetes v1.13.4 using kubeadm ...
: Waiting for pods: apiserver proxy etcd scheduler controller addon-manager dns
: Updating kube-proxy configuration ...
- Verifying component health ......
+ kubectl is now configured to use "minikube"
= Done! Thank you for using minikube!
启动后就可以使用kubectl来操作集群了。
$ kubectl get all
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1
443/TCP 12d
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready master 12d v1.13.4