kubernetes 使用Openstack Cinder的OKD中的持久卷

tquggr8v  于 2023-04-20  发布在  Kubernetes
关注(0)|答案(1)|浏览(133)

bounty已结束。回答此问题可获得+100声望赏金。赏金宽限期将在16小时后结束。Norhther正在寻找来自信誉良好的来源的答案

我想为我的pod创建一些持久卷。我正在使用以下版本:

[centos@svc ~]$ oc version
Client Version: 4.8.11
Server Version: 4.12.0-0.okd-2023-03-18-084815
Kubernetes Version: v1.25.0-2786+eab9cc98fe4c00-dirty

错误:

[centos@svc ~]$ oc create -f cinder-persistanvolume.yaml 
Error from server (Forbidden): error when creating "cinder-persistanvolume.yaml": persistentvolumes "pv01" is forbidden: error querying Cinder volume db044f6c-3420-4586-9e27-6e54268c994b: unable to initialize cinder client for region: RegionOne, err: cloud provider is not initialized: cannot initialize cloud provider using data from the secret: You must provide a password to authenticate
[centos@svc ~]$ cat cinder-persistanvolume.yaml 
apiVersion: "v1"
kind: "PersistentVolume"
metadata:
  name: "pv01" 
spec:
  capacity:
    storage: "10Gi" 
  accessModes:
    - "ReadWriteOnce"
  cinder: 
    fsType: "ext3" 
    volumeID: "db044f6c-3420-4586-9e27-6e54268c994b"

我的存储类:

[centos@svc ~]$ oc get storageclass
NAME                     PROVISIONER                RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
standard-csi (default)   cinder.csi.openstack.org   Delete          WaitForFirstConsumer   true                   9d

正如你所看到的,我正在使用Openstack部署okd,并且我将storageclass默认为cinder csi。然而,当尝试创建persistentVolume时,我得到了那个错误。我不知道如何对我的openstack服务器进行身份验证。我已经导出了环境变量OS_AUTH_TYPE, OS_REGION_NAME...,并且我可以发出令牌。
编辑:我试着按照这些步骤操作,我的openstack openrc文件看起来像这样:

#!/usr/bin/env bash

export OS_AUTH_TYPE=v3applicationcredential
export OS_AUTH_URL=...
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME="RegionOne"
export OS_INTERFACE=...
export OS_APPLICATION_CREDENTIAL_ID=...
export OS_APPLICATION_CREDENTIAL_SECRET=...

所以我的cloud.conf看起来像:

[Global]
auth-url = ...
application-credential-id = ...
application-credential-secret= ...
region = RegionOne

在应用cloud-controller-manager-roles.yaml、cloud-controller-manager-roles-bindings.yaml和openstack-cloud-controller-manager-ds.yaml之后,我在三个控制器管理器pod中的两个中发现了错误:

error: failed to create listener: failed to listen on 127.0.0.1:10258: listen tcp 127.0.0.1:10258: bind: address already in use

[centos@svc cloud-provider-openstack]$ kubectl get pods -n kube-system -w
NAME                                       READY   STATUS             RESTARTS        AGE
csi-cinder-nodeplugin-2c96w                3/3     Running            0               34m
csi-cinder-nodeplugin-8hmpq                3/3     Running            0               34m
csi-cinder-nodeplugin-8sl7p                3/3     Running            0               34m
csi-cinder-nodeplugin-9qwf2                3/3     Running            0               34m
csi-cinder-nodeplugin-bpqp4                3/3     Running            0               34m
csi-cinder-nodeplugin-qmcqx                3/3     Running            0               34m
openstack-cloud-controller-manager-4l9gk   1/1     Running            0               5m31s
openstack-cloud-controller-manager-blthh   0/1     CrashLoopBackOff   5 (2m36s ago)   5m31s
openstack-cloud-controller-manager-rpmxg   0/1     Error              6 (3m2s ago)    5m31s
vlurs2pr

vlurs2pr1#

根据错误消息,端口10258已在使用中。您需要停止侦听此端口。您可以通过运行fuser -k 10258/tcp来执行此操作。

相关问题