Norhther
Norhther

Reputation: 500

Persistent volume in OKD using Openstack Cinder

I want to create some persistent volumes for my pods. I'm using these versions:

[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

The error:

[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" 

And my storage classes:

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

As you can see, I'm using Openstack for the deployment of okd, and I have the storageclass default as cinder csi. However, when trying to create a persistentVolume, I get that error. I do not know how to authenticate to my openstack server. I have exported the environment variables OS_AUTH_TYPE, OS_REGION_NAME... and I can issue tokens.

EDIT: I tried following these steps, and my openstack openrc file looks like:

#!/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=...

So my cloud.conf looks like:

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

After applying cloud-controller-manager-roles.yaml, cloud-controller-manager-roles-bindings.yaml and openstack-cloud-controller-manager-ds.yaml I got errors in two of the three controller manager pods:

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

Upvotes: 2

Views: 341

Answers (1)

KMS
KMS

Reputation: 38

As per the error message port 10258 is already in use. You need to stop listening on this port. You can do this by running fuser -k 10258/tcp.

Upvotes: 0

Related Questions