隨筆- 34 文章- 1 評論- 2
ETCD搭建
- systemd啟動etcd服務的時候出現錯誤:Failed at step CHDIR spawning /usr/bin/etcd: No such file or directory
解決辦法:etcd.service服務配置檔案中設定的工作目錄WorkingDirectory=/var/lib/etcd/必須存在,否則會報以上錯誤
- systemd啟動etcd服務的時候出現錯誤:cannot assign requested address
解決辦法:繫結阿里雲的私網IP
- dial tcp 127.0.0.1:4001: getsockopt: connection refused
解決辦法:ETCD_LISTEN_CLIENT_URLS需要配置http://127.0.0.1:2379,特別注意,此處是http而不是https
- flannel
- failed to retrieve network config: 100: Key not found (/atomic.io)
解決辦法:/etc/sysconfig/flanneld
中的內容,FLANNEL_ETCD_PREFIX很可能是/atomic.io/network
,將其改為/coreos.com/network
。或者也可以通過-etcd-prefix指定
- failed to retrieve network config: invalid character ‘.’ after object key:value pair
解決辦法:這種問題一般是向etcd中匯入網路資訊的時候出錯了,檢查寫入的字元的中英文,ip地址是否有引號等語法問題
- 新增etcd節點後,啟動systemd服務出現Job for etcd.service failed because a timeout was exceeded
解決辦法:首先確保服務配置正確。出現該問題的原因可能時因為etcd的data-dir中的殘留資訊導致的,刪除data-dir中的內容,重新啟動etcd服務
- 部署app的時候出現類似如下錯誤,這種一般是模板中定義的型別錯誤引起的,如下錯誤為 v1.ObjectMeta: Annotations: ReadString: expects ” or n, but found t,可以檢視Annotations中是否有錯誤
Error from server (BadRequest): error when creating "sample-app.deploy.yaml": Deployment in version "v1beta2" cannot be handled as a Deployment: v1beta2.Deployment: Spec: v1beta2.DeploymentSpec: Template: v1.PodTemplateSpec: ObjectMeta: v1.ObjectMeta: Annotations: ReadString: expects " or n, but found t, error found in #10 byte of ...|/scrape":true},"labe|..., bigger context ...|rometheus.io/port":"8080","prometheus.io/scrape":true},"labels":{"app":"sample-app"}},"spec":{"conta|...
- kubelet
- 啟動kubelet的時候出現如下錯誤,導致kubelet啟動失敗。檢視kube-apiserver節點的系統日誌messages,可以看到錯誤日誌“authentication.go:64] Unable to authenticate the request due to an error: [invalid bearer token, [invalid bearer token, invalid bearer token]]”,檢查kuber-apiserver啟動引數中的token.csv和kubelet啟動引數中指定的bootstrap檔案bootstrap.kubeconfig中的token值是否一致,此外該token必須為實際數值,不能使用變數代替。出現網路錯誤日誌的原因是部署中使用了flannel外掛。
1 Mar 22 00:27:00 node1 kubelet[701]: W0322 00:27:00.078565 701 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d 2 Mar 22 00:27:00 node1 kubelet[701]: I0322 00:27:00.081847 701 server.go:374] Version: v1.10.0-alpha.3 3 Mar 22 00:27:00 node1 kubelet[701]: I0322 00:27:00.081897 701 feature_gate.go:226] feature gates: &{{} map[]} 4 Mar 22 00:27:00 node1 kubelet[701]: I0322 00:27:00.081960 701 plugins.go:89] No cloud provider specified. 5 Mar 22 00:27:00 node1 kubelet[701]: F0322 00:27:00.106954 701 server.go:231] failed to run Kubelet: cannot create certificate signing request: Unauthorized
疑問解決
kubelet使用tls bootstrapping功能時,kubeconfig檔案中指定的了token,為何設定叢集引數的時候還需要指定CA公鑰?
# 設定叢集引數
kubectl config set-cluster kubernetes \
--certificate-authority=/etc/kubernetes/ssl/ca.pem \
--embed-certs=true \
--server=${KUBE_APISERVER} \
--kubeconfig=bootstrap.kubeconfig
# 設定客戶端認證引數
kubectl config set-credentials kubelet-bootstrap \
--token=${BOOTSTRAP_TOKEN} \
--kubeconfig=bootstrap.kubeconfig
原因是,kubelet使用bootstrap功能時,需要使用ca證書通過apiserver的認證,使用token進行授權。證書和token分別屬於兩個階段使用的內容。
k8s中哪些元件需要進行tls證書認證,哪些不需要?
kube-scheduler、kube-controller-manager 一般和 kube-apiserver 部署在同一臺機器上,它們使用非安全埠和 kube-apiserver通訊,非安全埠預設為http的8080,可以使用–insecure-port指定,監聽非安全埠的地址預設為127.0.0.1,可以使用–insecure-bind-address指定;
kubelet、kube-proxy、kubectl 部署在其它 Node 節點上,如果通過安全埠訪問 kube-apiserver,則必須先通過 TLS 證書認證,再通過 RBAC 授權。安全埠預設為https的6443,可以使用–secure-port指定,監聽安全埠的地址預設為0.0.0.0(監聽所有介面),可以使用–bind-address指定。
分類: kubernetes
標籤: k8s kubernetes
0
0
» 下一篇:簡單瞭解C語言內嵌彙編
写评论
很抱歉,必須登入網站才能發佈留言。