failed to get admin secret from ["resource-quota"/"ceph-secret-rbd"]
K8s提示上面的错误,解决办法就是secret没有指定namespace,如下步骤:[root@k8s1 k8s-ceph]# kubectl get pvcNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEpvc01 Bo...
K8s 提示上面的错误,解决办法就是secret 没有指定namespace, 如下步骤:
[root@k8s1 k8s-ceph]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc01 Bound pv01 1Gi RWO 4h1m
storageclass-pvc01 Pending storageclass01 7m38s
[root@k8s1 k8s-ceph]# kubectl describe pvc storageclass-pvc01
-------------------------------------------------------------------------------------
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning ProvisioningFailed 52s (x11 over 8m59s) persistentvolume-controller Failed to provision volume with StorageClass "storageclass01": failed to get admin secret from ["resource-quota"/"ceph-secret-rbd"]: failed to get secret from ["resource-quota"/"ceph-secret-rbd"]: secrets "ceph-secret-rbd" not found
[root@k8s1 k8s-ceph]
没有发现安全认证信息: secrets "ceph-secret-rbd
################################################################################################
[root@k8s1 k8s-ceph]# kubectl delete pvc storageclass-pvc01
persistentvolumeclaim "storageclass-pvc01" deleted
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# kubectl delete storageclass storageclass01
storageclass.storage.k8s.io "storageclass01" deleted
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# cat /etc/ceph/ceph.client.admin.keyring
[client.admin]
key = AQAfLMFdptOdMRAA24zqFbx5kaKwLpuroPV0Ug==
caps mds = "allow *"
caps mgr = "allow *"
caps mon = "allow *"
caps osd = "allow *"
[root@k8s1 k8s-ceph]# echo "AQAfLMFdptOdMRAA24zqFbx5kaKwLpuroPV0Ug=="|base64
QVFBZkxNRmRwdE9kTVJBQTI0enFGYng1a2FLd0xwdXJvUFYwVWc9PQo=
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# cat ceph-secret-rbd.yaml
apiVersion: v1
kind: Secret
metadata:
name: ceph-secret-rbd
type: "kubernetes.io/rbd"
data:
key: QVFBZkxNRmRwdE9kTVJBQTI0enFGYng1a2FLd0xwdXJvUFYwVWc9PQo=
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# kubectl apply -f ceph-secret-rbd.yaml
secret/ceph-secret-rbd created
[root@k8s1 k8s-ceph]# kubectl get secret
NAME TYPE DATA AGE
ceph-secret-admin kubernetes.io/rbd 1 28h
ceph-secret-rbd kubernetes.io/rbd 1 10h
default-token-c9rjq kubernetes.io/service-account-token 3 8d
kubernetes-dashboard-certs Opaque 2 7d5h
prometheus-operator-token-hzhb4 kubernetes.io/service-account-token 3 26h
prometheus-token-4dnn6 kubernetes.io/service-account-token 3 26h
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# cat storageclass.yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: storageclass01
provisioner: kubernetes.io/rbd
parameters:
monitors: 10.83.35.79:6789,10.83.35.80:6789,10.83.35.81:6789
adminId: admin
adminSecretName: ceph-secret-rbd
adminSecretNamespace: default
pool: kubernets
userId: admin
userSecretName: ceph-secret-rbd
fsType: ext4
imageFormat: "2"
imageFeatures: "layering"
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# kubectl apply -f storageclass.yaml
storageclass.storage.k8s.io/storageclass01 created
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# kubectl get storageclass
NAME PROVISIONER AGE
storageclass01 kubernetes.io/rbd 107s
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# cat storageclass-pvc.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: storageclass-pvc01
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 1Gi
storageClassName: storageclass01
[root@k8s1 k8s-ceph]#
################################################################################################
[root@k8s1 k8s-ceph]#
[root@k8s1 k8s-ceph]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc01 Bound pv01 1Gi RWO 4h54m
storageclass-pvc01 run storageclass01 6s
更多推荐
所有评论(0)