2016-07-27 47 views
0

我試圖在kubernetes上部署Pachyderm(docker bigdata平臺)。受限於Pachyderm,我必須安裝舊版本的kubernetes v1.2.2。我遵循指南http://kubernetes.io/docs/getting-started-guides/docker/通過docker在本地服務器上部署Kubernetes。該指南可以使用kubernetes> = 1.3.0,但是當我使用它來部署kubernetes 1.2.2時,我遇到了一些問題。Kubernetes v1.2.2 api-server dosen't start

docker ps -a 
CONTAINER ID  IMAGE            COMMAND     CREATED    STATUS      PORTS    NAMES 
ec38ae951f09  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/hyperkube apiserver" 8 seconds ago  Exited (255) 7 seconds ago      k8s_apiserver.78ec1de_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_d26fc24e 
55c1b13bb610  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/setup-files.sh IP:1" 8 seconds ago  Up 8 seconds          k8s_setup.e5aa3216_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_1cb4c220 
b9f0e5b3a7a9  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/hyperkube scheduler" 9 seconds ago  Up 8 seconds          k8s_scheduler.fc12fcbe_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_e5065506 
9cd613d272bc  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/hyperkube apiserver" 9 seconds ago  Exited (255) 8 seconds ago      k8s_apiserver.78ec1de_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_c04426af 
49fe2c409386  gcr.io/google_containers/etcd:2.2.1    "/usr/local/bin/etcd " 10 seconds ago  Up 9 seconds          k8s_etcd.7e452b0b_k8s-etcd-127.0.0.1_default_1df6a8b4d6e129d5ed8840e370203c11_a6f11fdb 
5b208be18c71  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/hyperkube controlle" 10 seconds ago  Up 9 seconds          k8s_controller-manager.70414b65_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_c377c5e9 
df194f3cf663  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/hyperkube proxy --m" 10 seconds ago  Up 9 seconds          k8s_kube-proxy.9a9f4853_k8s-proxy-127.0.0.1_default_5e5303a9d49035e9fad52bfc4c88edc8_63ec0b04 
58b53ec28fbe  gcr.io/google_containers/pause:2.0    "/pause"     10 seconds ago  Up 9 seconds          k8s_POD.6059dfa2_k8s-etcd-127.0.0.1_default_1df6a8b4d6e129d5ed8840e370203c11_21034b2e 
df48fe4cdf0a  gcr.io/google_containers/pause:2.0    "/pause"     10 seconds ago  Up 9 seconds          k8s_POD.6059dfa2_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_4867dbbc 
fe6b74c2a881  gcr.io/google_containers/pause:2.0    "/pause"     10 seconds ago  Up 9 seconds          k8s_POD.6059dfa2_k8s-proxy-127.0.0.1_default_5e5303a9d49035e9fad52bfc4c88edc8_fad2c558 
4c00ad498916  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/hyperkube kubelet -" 25 seconds ago  Up 24 seconds         kubelet 

從Docker容器表中可以看到,當部署kubernetes1.2.2時,我的apiserver處於關閉狀態。 kubernetes apiserver的重啓間隔服從expontional backoff算法。但從來沒有工作。

然後,

sv: batch/v1 
    mv: extensions/__internal 
I0727 06:06:27.593708  1 genericapiserver.go:82] Adding storage destination for group batch 
W0727 06:06:27.593745  1 server.go:383] No RSA key provided, service account token authentication disabled 
F0727 06:06:27.593767  1 server.go:410] Invalid Authentication Config: open /srv/kubernetes/basic_auth.csv: no such file or directory 

請參閱kubernetes的搬運工日誌API服務器在這裏。請注意,發生了一些身份驗證錯誤,似乎Kubernetes沒有所需的密鑰被允許。也可以在此查看控制器管理器日誌。控制器管理器等待apiserver,但apiserver沒有跑過。控制器管理器也是轉儲。

E0727 06:07:10.604801  1 controllermanager.go:259] Failed to get api versions from server: Get http://127.0.0.1:8080/api: dial tcp 127.0.0.1:8080: connection refused 
E0727 06:07:11.604832  1 controllermanager.go:259] Failed to get api versions from server: Get http://127.0.0.1:8080/api: dial tcp 127.0.0.1:8080: connection refused 
E0727 06:07:12.604752  1 controllermanager.go:259] Failed to get api versions from server: Get http://127.0.0.1:8080/api: dial tcp 127.0.0.1:8080: connection refused 
E0727 06:07:13.604803  1 controllermanager.go:259] Failed to get api versions from server: Get http://127.0.0.1:8080/api: dial tcp 127.0.0.1:8080: connection refused 
E0727 06:07:14.604332  1 nodecontroller.go:229] Error monitoring node status: Get http://127.0.0.1:8080/api/v1/nodes: dial tcp 127.0.0.1:8080: connection refused 
E0727 06:07:14.604619  1 controllermanager.go:259] Failed to get api versions from server: Get http://127.0.0.1:8080/api: dial tcp 127.0.0.1:8080: connection refused 
E0727 06:07:14.604861  1 controllermanager.go:259] Failed to get api versions from server: Get http://127.0.0.1:8080/api: dial tcp 127.0.0.1:8080: connection refused 
F0727 06:07:14.604957  1 controllermanager.go:263] Failed to get api versions from server: timed out waiting for the condition 

所以對於我的問題,如何解決這個問題?這個問題困擾了我很長一段時間。

============================================== ====================== 更新:

在Goblin和Lukie的幫助下,我發現關鍵問題是Setup Pods沒有觸發。 見Kubernetes的清單,

{ 
     "name": "controller-manager", 

       "/hyperkube", 
       "controller-manager", 
       "--master=127.0.0.1:8080", 
       "--service-account-private-key-file=/srv/kubernetes/server.key", 
       "--root-ca-file=/srv/kubernetes/ca.crt", 
       "--min-resync-period=3m", 
       "--v=2" 
     ], 
     "volumeMounts": [ 
     { 
      "name": "data", 
      "mountPath": "/srv/kubernetes" 
     } 
     ] 
    } 

選項--service-account-private-key-file=/srv/kubernetes/server.key已經在清單文件中添加,但它不工作。換句話說,控制器管理器在文件系統中找不到這個文件。以下命令支持此假設。

docker exec a82d7f6e4d7d ls -l /srv/kubernetes 
ls: cannot access /srv/kubernetes: No such file or directory 

接下來,我們檢查是否Setup Pod把文件中的泊塢窗volumn。不幸的是,我們發現Setup Pod沒有被觸發和工作,因此在文件系統中沒有寫入任何證書文件。

docker ps -a | grep setup 
54afdd81349e  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/setup-files.sh IP:1" About a minute ago Up About a minute         k8s_setup.e5aa3216_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_a2edddca 
6f714e034098  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/setup-files.sh IP:1" 4 minutes ago  Exited (7) 2 minutes ago       k8s_setup.e5aa3216_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_0d7dab5b 
8358f6644d94  gcr.io/google_containers/hyperkube-amd64:v1.2.2 "/setup-files.sh IP:1" 6 minutes ago  Exited (7) 4 minutes ago       k8s_setup.e5aa3216_k8s-master-127.0.0.1_default_4c6ab43ac4ee970e1f563d76ab3d3ec9_41e4c686 

是否有任何方法可以進一步調試?或者它是Kubernetes版本1.2中的錯誤?

回答

0
F0727 06:06:27.593767  1 server.go:410] Invalid Authentication Config: open /srv/kubernetes/basic_auth.csv: no such file or directory 

您缺少基本驗證文件/srv/kubernetes/basic_auth.csv要麼創建基本驗證文件,要麼刪除配置標誌。

Kubernetes authentication

0

實際上它是W0727 06:06:27.593745 1 server.go:383] No RSA key provided, service account token authentication disabled這是在我看來更重要。

似乎在控制器管理器上缺少--service-account-private-key-file,所以無法正確生成服務令牌。

相關問題