k8s

mac 安装minikube

brew install kubectl

curl -Lo minikube http://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v0.25.2/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

minikube start --registry-mirror=https://registry.docker-cn.com

minikube dashboard

kubectl cluster-info 查看当前集群信息

我们可以通过minikube ssh进到虚机里,然后看看是否有一些container运行起来了


➜  ~ minikube ssh
                         _             _
            _         _ ( )           ( )
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

$ docker ps
CONTAINER ID        IMAGE                                      COMMAND                  CREATED             STATUS              PORTS               NAMES
c1aec3464788        gcr.io/k8s-minikube/storage-provisioner    "/storage-provisioner"   8 minutes ago       Up 8 minutes                            k8s_storage-provisioner_storage-provisioner_kube-system_05db116c-236a-11e8-985b-08002709a6e3_0
f36a4455bc73        fed89e8b4248                               "/sidecar --v=2 --..."   8 minutes ago       Up 8 minutes                            k8s_sidecar_kube-dns-54cccfbdf8-c7k5b_kube-system_0649fdef-236a-11e8-985b-08002709a6e3_0
e49e279c5717        459944ce8cc4                               "/dnsmasq-nanny -v..."   8 minutes ago       Up 8 minutes                            k8s_dnsmasq_kube-dns-54cccfbdf8-c7k5b_kube-system_0649fdef-236a-11e8-985b-08002709a6e3_0
1ec9842ec31d        512cd7425a73                               "/kube-dns --domai..."   8 minutes ago       Up 8 minutes                            k8s_kubedns_kube-dns-54cccfbdf8-c7k5b_kube-system_0649fdef-236a-11e8-985b-08002709a6e3_0
805346db62f0        e94d2f21bc0c                               "/dashboard --inse..."   8 minutes ago       Up 8 minutes                            k8s_kubernetes-dashboard_kubernetes-dashboard-77d8b98585-ghb5p_kube-system_0630dbdf-236a-11e8-985b-08002709a6e3_0
2c3edf77349e        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 8 minutes ago       Up 8 minutes                            k8s_POD_kube-dns-54cccfbdf8-c7k5b_kube-system_0649fdef-236a-11e8-985b-08002709a6e3_0
19313f1076da        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 8 minutes ago       Up 8 minutes                            k8s_POD_kubernetes-dashboard-77d8b98585-ghb5p_kube-system_0630dbdf-236a-11e8-985b-08002709a6e3_0
a340e072f095        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 8 minutes ago       Up 8 minutes                            k8s_POD_storage-provisioner_kube-system_05db116c-236a-11e8-985b-08002709a6e3_0
dab3d03f880b        d166ffa9201a                               "/opt/kube-addons.sh"    8 minutes ago       Up 8 minutes                            k8s_kube-addon-manager_kube-addon-manager-minikube_kube-system_c4c3188325a93a2d7fb1714e1abf1259_0
75c8fe4570a1        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 8 minutes ago       Up 8 minutes                            k8s_POD_kube-addon-manager-minikube_kube-system_c4c3188325a93a2d7fb1714e1abf1259_0


然后退出来,在本地运行`minikube dashboard` 会在本地弹出浏览器,就是Kubernetes的dashboard,那基本上恭喜您,安装成功了。