搭建kubernetes時容易遇到的問題


因為網上關於如何搭建kubernetes的文章很多(劉天斯大神的很不錯 鏈接:http://blog.liuts.com/post/247/)

所以具體過程我就不再敘述了,我只說我在搭建過程中遇到的問題。

我的集群主機系統版本為:centos7

我使用的etcd版本為:etcd-0.4.6-7.el7.centos.x86_64.rpm

kubernetes版本為:kubernetes-1.1.0-0.4.git2bfa9a1.el7.x86_64.rpm

配置參考文檔為:https://github.com/kubernetes/kubernetes/blob/a676b118b9ecb5f1f1797531ba6f555e82d58201/docs/getting-started-guides/centos/centos_manual_config.md

1.錯誤提示信息

  Unable to listen for secure (open /var/run/kubernetes/apiserver.crt: no such file or directory)

  解決方案:

     創建 目錄/var/run/kubernetes/

  # vim /usr/lib/systemd/system/kube-apiserver.service

  Service下增加如下內容:

  [Service]
  PermissionsStartOnly=true
  ExecStartPre=/usr/bin/chown -R kube:kube /var/run/kubernetes/
 
2.官方的配置文檔以及gitHub上的kubernetes的配置文檔中有一些參數不正確,還請各位仔細觀察,下面列出錯誤的參數:
  錯誤參數均為中間帶"-的",正確的應該為"_"
  誤:KUBELET_PORT="--kubelet-port=10250"
  正:KUBELET_PORT="--kubelet_port=10250"
  誤:KUBE_ETCD_SERVERS="--etcd-servers=http://centos-master:4001"
  正:KUBE_ETCD_SERVERS="--etcd_servers=http://centos-master:4001"
  誤:KUBE_ALLOW_PRIV="--allow-privileged=false"
  正:KUBE_ALLOW_PRIV="--allow_privileged=false"
  誤:KUBELET_HOSTNAME="--hostname-override=centos-minion172"
  正:KUBELET_HOSTNAME="--hostname_override=centos-minion172"
  誤:KUBELET_API_SERVER="--api-servers=http://centos-master:8080"
  正:KUBELET_API_SERVER="--api_servers=http://centos-master:8080"
3.如果執行kubectl get nodes時得到的集群主機狀態為NotReady
  請檢查防火牆firewalld.service  iptables.service
  systemctl stop iptables.service
  systemctl disable iptables.service
  systemctl stop firewalld.service
  systemctl disable firewalld.service
4.如果執行kubectl get pods -o wide時得到的結果中,READY始終為0/1,而RESTARTS數量卻為>1的情況
  那么是由於你創建POD或者replication的時候使用的鏡像不正確
  鏡像的根目錄下一定要有一個run.sh文件,這樣啟動的容器才會是一直running的狀態
5.集群node主機上的kubelet配置文件最后一項請修改為:

  KUBELET_ARGS="--pod-infra-container-image={私有倉庫地址}/pause:0.8.0"

  提前在本地私有倉庫准備好此鏡像或者指定可以下載到的鏡像地址

6.起來master主機上的服務時,遇到類似如下錯誤:

  No cloud provider specified.

  Failed to start service controller: ServiceController should not be run without a cloudprovider.

  此類錯誤,目前未發現會影響具體哪些功能,待后面發現再進行解決

 

 

歡迎各位指正,遇到新的情況,我會繼續補充。

下面貼出我的配置文件,供各位參考

config  (master和node一樣)

 

apiserver   (只配置master)

kubelet (只配置node)

下面是我創建的RC和SERVICE

順利貼出來我的兩個yaml文件 供參考


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM