Play-k8s-on-win10

follow the offical guaide,install and play k8s on windows.

结论

使用官方的minikube,无法pull k8s需要的docker镜像,所以无法安装成功。使用阿里云修改的minikube安装成功。

安装过程

  1. 安装kubectl
    use administrator open powershell
    1
    2
    Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    choco install kubernetes-cli

2 下载阿里修改版minikube,运行集群
download minikube-windows from link
in china ,download from google is inposible,so we use aliyun’s minikube.download

rename minikube-windows to minikube and mv to c:\windows\system32\

add a hyper-v switch named “MinikubeSwitch” on hy-v control
start a k8s

1
minikube.exe start --registry-mirror=https://registry.docker-cn.com --vm-driver="hyperv" --memory=4096 --hyperv-virtual-switch="MinikubeSwitch"

check cluster status kubectl version

1
2
3
-> kubctl.exe version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.2", GitCommit:"5fa2db2bd46ac79e5e00a4e6ed24191080aa463b", GitTreeState:"clean", BuildDate:"2018-01-18T10:09:24Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

怎么玩

1 打开dashboard .\minikube.exe dashboard
2

遇到的问题

网上一些文章通过手动下载minikube.iso和localkube,然后使用官方的minikube安装,安装到后面阶段会去拉取k8s集群需要的一些docker容器,由于官方的minikube需要到google去拉取,就会一直等待拉取失败。

minikube创建好虚拟机后,使用 minikube ssh 可以直接ssh到虚拟机中。如果证书等错误,会ssh失败。通过minikube delete删除”.minikube”目录后重新安装解决。

kubernetes.go:119] error getting Pods with label selector “k8s-app=kube-proxy” [Get https://192.168.199.105:8443/api/v1/namespaces/kube-system/pods?labelSelector=k8s-app%3Dkube-proxy: dial tcp 192.168.199.105:8443: connectex: No connection could be made because the target machine actively refused it.]
停止 shadowsocks后再重新运行启动命令解决。

1
minikube start --vm-driver=hyperv --hyperv-virtual-switch=minikube --v=7 --alsologtostderr

https://mp.weixin.qq.com/s?timestamp=1532306214&src=3&ver=1&signature=QcXUm-wCYehMfkul962-YHQMWaAZzw49fSb5BLxUp*yH7CaHLonVfLEXq76Do6d08*Dgr8Xo*c66i-6-t0jHb4bkLx7qor3j3Oo2qcpR00jvvnrQS7SVivuxMEo-jGNiGQgk86KycRg8OCKeGwY8L0PhqBpJNzUaeDb5DqI03G4=
https://yq.aliyun.com/articles/221687