簡體   English   中英

無法獲取 AWS 雲提供商。 GetCloudProvider 返回<nil>反而

[英]Failed to get AWS Cloud Provider. GetCloudProvider returned <nil> instead

我有一個手工構建的 Kubernets 集群 1.11.4,使用 CentOS 作為 AWS ec2 實例運行,1 個主節點和 1 個從節點。 集群非常穩定。 我想將 JupyterHub 部署到集群中。 此處此處的文檔列出了有關配置 EFS 的一些詳細信息。 我選擇使用 EBS。

pvc 失敗:

Failed to get AWS Cloud Provider. GetCloudProvider returned <nil> instead
Mounted By:  hub-76ffd7d94b-dmj8l

以下是 StorageClass 定義:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: gp2
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
  fsType: ext4

光伏yaml:

kind: PersistentVolume
apiVersion: v1
metadata:
  name: jupyterhub-pv
  labels:
    type: amazonEBS
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadWriteMany
  awsElasticBlockStore:
    volumeID: vol-0ddb700735db435c7
    fsType: ext4

pvc yaml:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: jupyterhub-pvc
  labels:
    type: amazonEBS
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
$ kubectl -n jhub describe pvc hub-db-dir

返回:

Name:          hub-db-dir
Namespace:     jhub
StorageClass:  standard  <========from an earlier try
Status:        Pending
Volume:
Labels:        app=jupyterhub
               chart=jupyterhub-0.8.2
               component=hub
               heritage=Tiller
               release=jhub
Annotations:   volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Events:
  Type       Reason              Age                     From                         Message
  ----       ------              ----                    ----                         -------
  Warning    ProvisioningFailed  110s (x106 over 3h43m)  persistentvolume-controller  Failed to provision volume with StorageClass "standard": Failed to get AWS Cloud Provider. GetCloudProvider returned <nil> instead
Mounted By:  hub-76ffd7d94b-dmj8l

對我來說,這看起來像是 pod 嘗試掛載存儲,但失敗了。 隔離這個錯誤一直是一個挑戰。 我嘗試修補 pvc 以將 storageclass 更新為gp2 ,現在標記為默認值,但在我部署 pvc 策略時還沒有。 打補丁失敗:

$ kubectl -n jhub patch pvc hub-db-dir -p '{"spec":{"StorageClass":"gp2"}}'
persistentvolumeclaim/hub-db-dir patched (no change)
$ kubectl -n jhub describe pvc hub-db-dir
Name:          hub-db-dir
Namespace:     jhub
StorageClass:  standard  <====== Not changed
Status:        Pending
Volume:
Labels:        app=jupyterhub
               chart=jupyterhub-0.8.2
               component=hub
               heritage=Tiller
               release=jhub
Annotations:   volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Events:
  Type       Reason              Age                      From                         Message
  ----       ------              ----                     ----                         -------
  Warning    ProvisioningFailed  2m26s (x108 over 3h48m)  persistentvolume-controller  Failed to provision volume with StorageClass "standard": Failed to get AWS Cloud Provider. GetCloudProvider returned <nil> instead
Mounted By:  hub-76ffd7d94b-dmj8l

JupyterHub 部署由 Helm/tiller 管理,因此在進行任何更改時,我使用以下內容更新 pod:

$ helm upgrade jhub jupyterhub/jupyterhub --version=0.8.2 -f config.yaml

config.yaml 文件中用於分配用戶存儲的相關部分是:

proxy:
  secretToken: "<random value>"
singleuser:
  cloudMetadata:
    enabled: true
singleuser:
  storage:
    dynamic:
      storageClass: gp2
singleuser:
  storage:
    extraVolumes:
      - name: jupyterhub-pv
        persistentVolumeClaim:
          claimName: jupyterhub-pvc
    extraVolumeMounts:
      - name: jupyterhub-pv
        mountPath: /home/shared

部分故障排除還側重於讓集群知道其資源是由 AWS 提供的。 為此,我在 kubernets 配置文件中有:

/usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf

該行:

Environment="KUBELET_EXTRA_ARGS=--cloud-provider=aws --cloud-config=/etc/kubernetes/cloud-config.conf

其中: /etc/kubernetes/cloud-config.conf包含:

[Global]
KubernetesClusterTag=kubernetes
KubernetesClusterID=kubernetes

kube-controller-manager.yamlkube-apiserver.yaml我添加了以下行:

- --cloud-provider=aws

我還沒有標記任何 AWS 資源,但會根據這個開始做。

我接下來的故障排除步驟是什么?

謝謝!

這個鏈接可能有幫助嗎?

在將節點添加到集群之前,您必須將--cloud-provider=aws標志添加到 Kubelet。 AWS 集成的關鍵是 Node 對象上的一個特定字段 - .spec.providerID字段 - 只有在將節點添加到集群時該標志存在時才會填充該字段。 如果您將節點添加到集群,然后添加命令行標志,則不會填充此字段/值,並且集成將無法按預期工作。 在這種情況下沒有出現錯誤(至少,不是我能夠找到的)。

如果您發現 Node 對象上缺少.spec.providerID字段,您可以使用 kubectl edit node 命令添加它。 此字段的值格式為aws:///<az-of-instance>/<instance-id>

我遇到了類似的錯誤並找到了這篇博客文章。 它描述了相同的症狀並提供故障排除建議。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM