ionos-cloud / docker-machine-driver

IONOS Cloud Docker Machine Driver
Apache License 2.0
6 stars 3 forks source link

Add Cloud Credentials for support of RKE2 #40

Closed mueller-tobias closed 1 year ago

mueller-tobias commented 1 year ago

Current SDK Version

6.0.1

Use-cases

To Deploy RKE2 Cluster with Rancher, the Node Driver needs to support Cloud Credentials. Due the fact that RKE2 Cluster doesn't have Node Templates, the credentials to access the cloud provider has to be stored as cloud credentials.

Attempted Solutions

Remove the credentials from the node template parameter set and add the credentials via rancher cloud credentials.

Proposal

Add the ability to store the credentials to access the IONOS Cloud as rancher cloud credentials.

avirtopeanu-ionos commented 1 year ago

Hi, it seems like currently there is a workaround to get Rancher to register the right Cloud Credential fields. This would allow adding cloud credentials for any IONOS driver version.

  1. After adding the docker driver to Rancher, click "View in API".
  2. Under "Operations", click "Edit"
  3. Under "Annotations", add the following annotations:
  1. Click "Show Request" and "Send Request". Then, refresh cache - you can use CTRL + F5.

After following these steps, you should now be able to add cloud credentials for RKE2 clusters. These cloud credentials should stay around regardless of docker driver version.

mueller-tobias commented 1 year ago

It's seems to be not only the credentials are a problem. With the credentials "fixed" by your workaround i got the dialog to configure a machine pool. The next problem was the missing node driver. Rancher didn't find the ionos node driver. Seems like the node driver dosn't supply a name and got one via autogeneration:

❯ kubectl get nodedrivers.management.cattle.io
NAME            AGE
aliyunecs       55d
amazonec2       55d
azure           55d
cloudca         55d
cloudscale      55d
digitalocean    55d
exoscale        55d
google          55d
harvester       55d
linode          55d
nd-f97kl        6d20h <- IONOS Driver
nutanix         55d
oci             55d
openstack       55d
otc             55d
outscale        54d
packet          55d
pinganyunecs    55d
pnap            55d
rackspace       55d
softlayer       55d
vmwarevsphere   55d

i fixed this by removing the node driver and add it via yaml file with the correct name:

❯ kubectl get nodedrivers.management.cattle.io
NAME            AGE
aliyunecs       55d
amazonec2       55d
azure           55d
cloudca         55d
cloudscale      55d
digitalocean    55d
exoscale        55d
google          55d
harvester       55d
ionoscloud      27s
linode          55d
nutanix         55d
oci             55d
openstack       55d
otc             55d
outscale        54d
packet          55d
pinganyunecs    55d
pnap            55d
rackspace       55d
softlayer       55d
vmwarevsphere   55d

Now Rancher is able to find the node driver, but is not able to deploy a machine. In the Log i see the following errors:

2022/12/21 08:31:33 [ERROR] error syncing 'fleet-default/ionos-rke2-pool1-adbb6a0a-466rr': handler machine-provision-remove: failed to delete fleet-default/ionos-rke2-pool1-adbb6a0a-466rr-machine-provision-extension rbac.authorization.k8s.io/v1, Kind=RoleBinding for  fleet-default/ionos-rke2-pool1-adbb6a0a-466rr: rolebindings.rbac.authorization.k8s.io "ionos-rke2-pool1-adbb6a0a-466rr-machine-provision-extension" not found, requeuing
2022/12/21 08:31:33 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:33 [ERROR] error syncing 'fleet-default/ionos-rke2-bootstrap-template-v9ngm': handler rke-machine: failed to delete fleet-default/ionos-rke2-bootstrap-template-v9ngm-machine-plan /v1, Kind=Secret for rke-machine fleet-default/ionos-rke2-bootstrap-template-v9ngm: secrets "ionos-rke2-bootstrap-template-v9ngm-machine-plan" not found, failed to delete fleet-default/ionos-rke2-bootstrap-template-v9ngm-machine-bootstrap /v1, Kind=ServiceAccount for rke-machine fleet-default/ionos-rke2-bootstrap-template-v9ngm: serviceaccounts "ionos-rke2-bootstrap-template-v9ngm-machine-bootstrap" not found, failed to delete fleet-default/ionos-rke2-bootstrap-template-v9ngm-machine-plan /v1, Kind=ServiceAccount for rke-machine fleet-default/ionos-rke2-bootstrap-template-v9ngm: serviceaccounts "ionos-rke2-bootstrap-template-v9ngm-machine-plan" not found, failed to delete fleet-default/ionos-rke2-bootstrap-template-v9ngm-machine-plan rbac.authorization.k8s.io/v1, Kind=Role for rke-machine fleet-default/ionos-rke2-bootstrap-template-v9ngm: roles.rbac.authorization.k8s.io "ionos-rke2-bootstrap-template-v9ngm-machine-plan" not found, requeuing
2022/12/21 08:31:33 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:33 [ERROR] [CAPI] Reconciler error: machines.cluster.x-k8s.io "ionos-rke2-pool1-bbf54b679-xwgd7" not found
2022/12/21 08:31:33 [ERROR] [CAPI] Reconciler error: machines.cluster.x-k8s.io "ionos-rke2-pool1-bbf54b679-xwgd7" not found
2022/12/21 08:31:33 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:33 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:33 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:33 [ERROR] error syncing 'fleet-default/ionos-rke2-pool1-adbb6a0a-ggjcb': handler machine-provision: no machine owner ref, requeuing
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:34 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:39 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:39 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:39 [INFO] [MachineProvision] Failed to create infrastructure fleet-default/ionos-rke2-pool1-adbb6a0a-ggjcb for machine ionos-rke2-pool1-bbf54b679-v2479, deleting and recreating...
2022/12/21 08:31:39 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:39 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:39 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:39 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
2022/12/21 08:31:39 [INFO] [MachineProvision] Failed to create infrastructure fleet-default/ionos-rke2-pool1-adbb6a0a-ggjcb for machine ionos-rke2-pool1-bbf54b679-v2479, deleting and recreating...
2022/12/21 08:31:39 [INFO] [planner] rkecluster fleet-default/ionos-rke2: waiting: waiting for viable init node
mrndev commented 1 year ago

@TobiasMuellerES , as it seems that generic RKE2 support requires a bit more investigation/work, can you maybe open a new ticket for this? It will be easier to manage the information this way. Thanks!

mueller-tobias commented 1 year ago

Tested in v7.0.0.rc2. Can be closed with the final v7.0.0 release of the machine driver