開始學習kubernetes V1.6.6,但是kubernetes V1.7.0已然發佈,但還是想着寫搞完1.6版在學1.7,沒想到1.6的變動,相比1.5的還是有大修改,在配置方面。
1、問題一:本地已然有【gcr.io/google_containers/pause-amd64:3.0】,但k8s依然要去gcr.io下載
unable to pull sandbox image \"gcr.io/google_containers/pause-amd64:3.0\": Error response from daemon:
invalid registry endpoint https://gcr.io/v0/: unable to ping registry endpoint https://gcr.io/v0/\nv2
ping attempt failed with error: Get https://gcr.io/v2/: dial tcp 74.125.204.82:443:
i/o timeout\n v1 ping attempt failed with error: Get https://gcr.io/v1/_ping: dial tcp
74.125.204.82:443: i/o timeout.
[root@www kubernetes_yaml_v1]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE centos6.4_ip latest 1c1901d062dd 4 weeks ago 907.9 MB gcr.io/google_containers/pause-amd64 3.0 8e76656d5e5d 12 months ago 746.9 kB |
和之前版本較爲不同,一般是先檢測本地鏡像是否存在,沒有再去拉去
解決辦法:
①、將原來的pause-amd64:3.0,重新tag過
②、將鏡像push到本地的registry
③、在kubelet加上--pod-infra-container-image=www.perofu.com:7070/google_containers/pause-amd64:3.0
2、問題二:Invalid --security-opt: \"seccomp:unconfined\""
3s 1s 3 kubelet, 192.168.0.211 Warning FailedSync Error syncing pod, skipping: failed to "CreatePodSandbox" for "web-0_default(7037d6cf-7280-11e7-af67-000c299603f3)" with CreatePodSandboxError: "CreatePodSandbox for pod \"web-0_default(7037d6cf-7280-11e7-af67-000c299603f3)\" failed: rpc error: code = 2 desc = failed to create a sandbox for pod \"web-0\": Error response from daemon: Invalid --security-opt: \"seccomp:unconfined\""
搜索了很多,沒看到什麼解決辦法,偶然測試下,發下是docker本身的問題:
[root@www ~]# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64
[root@www ~]# docker run -d --security-opt seccomp=unconfined 8e76656d5e5d
Error response from daemon: Invalid --security-opt: "seccomp=unconfined"
雖然kube 1.6是支持docker-engine-1.7的API,但是就【--security-opt seccomp=unconfined】不行
之前遇到過的是,新的k8s版本完全不支持docker api【 Kubernetes 1.2 就是這樣的】,現在是支持api,但不支持某個功能
解決:升級Docker版本,目前升級到docker-engine-1.12,正常
3、總結【K8s V1.6之後的版本】:
①、etcd 需要安裝v3以上的版本
②、pause-amd64鏡像,需要在kubelet加上--pod-infra-container-image
③、docker需要支持--security-opt: "seccomp=unconfined",不行就更新Docker版本。
如有錯誤,還望指正。