vexxhost / magnum-cluster-api

Cluster API driver for OpenStack Magnum
Apache License 2.0
45 stars 20 forks source link

Add documentation for using with Kolla #151

Open mnaser opened 1 year ago

mnaser commented 1 year ago

Since we're more familiar with OSA, we can probably do #152 first and build this off of the same.

berendt commented 1 year ago

I started with the integration in Kolla-Ansible: https://review.opendev.org/c/openstack/kolla-ansible/+/896292.

With this patch and installed magnum-cluster-api plugin inside the magnum container images I have this error when trying to create the COE:

Cluster type (vm, Unset, kubernetes) not supported (HTTP 400) (Request-ID: req-71b9046a-61d2-498d-b0f4-243ce729f9cf)
berendt commented 1 year ago

Wrong image ID. It works with a correct image ID:

Request to create cluster template k8s-v1.27.5 accepted
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| insecure_registry     | -                                    |
| labels                | {'kube_tag': 'v1.27.5'}              |
| updated_at            | -                                    |
| floating_ip_enabled   | True                                 |
| fixed_subnet          | -                                    |
| master_flavor_id      | SCS-2V-4-10                          |
| uuid                  | df0e74af-6938-40a6-9062-2f9de3c316da |
| no_proxy              | -                                    |
| https_proxy           | -                                    |
| tls_disabled          | False                                |
| keypair_id            | -                                    |
| public                | False                                |
| http_proxy            | -                                    |
| docker_volume_size    | -                                    |
| server_type           | vm                                   |
| external_network_id   | public                               |
| cluster_distro        | ubuntu                               |
| image_id              | 929b90b6-202a-4651-b3d2-2b70e39d592f |
| volume_driver         | -                                    |
| registry_enabled      | False                                |
| docker_storage_driver | overlay2                             |
| apiserver_port        | -                                    |
| name                  | k8s-v1.27.5                          |
| created_at            | 2023-09-22T20:16:16+00:00            |
| network_driver        | calico                               |
| fixed_network         | -                                    |
| coe                   | kubernetes                           |
| flavor_id             | SCS-2V-4-10                          |
| master_lb_enabled     | True                                 |
| dns_nameserver        | 8.8.8.8                              |
| hidden                | False                                |
| tags                  | -                                    |
+-----------------------+--------------------------------------+
berendt commented 1 year ago

After installing helm in the magnum-conductor container image + provisioning of Manila & Barbican I can start the creation of new clusters. I also have a magnum-system namespace in the Cluster API management cluster:

$ kubectl get namespaces
NAME                                STATUS   AGE
default                             Active   2d14h
kube-system                         Active   2d14h
kube-public                         Active   2d14h
kube-node-lease                     Active   2d14h
metallb-system                      Active   2d14h
cert-manager                        Active   2d14h
capi-system                         Active   2d14h
capi-kubeadm-bootstrap-system       Active   2d14h
capi-kubeadm-control-plane-system   Active   2d14h
capo-system                         Active   2d14h
magnum-system                       Active   41m

Creation of the cluster itself is hanging:

2023-09-22 21:07:21.165 7 DEBUG magnum.service.periodic [-] Updating status for cluster 9 update_status /var/lib/kolla/venv/lib/python3.10/site-packages/magnum/service/periodic.py:67
2023-09-22 21:07:21.257 7 DEBUG magnum.service.periodic [-] Status for cluster 9 updated to CREATE_IN_PROGRESS (CAPI Cluster status: Provisioning: Cluster kube-bpm9m is Provisioning. CAPI OpenstackCluster status reason: ) update_status /var/lib/kolla/venv/lib/python3.10/site-packages/magnum/service/periodic.py:84

Maybe the used Cluster API & CAPO versions are too new?

CAPI_VERSION="v1.5.1"
CAPO_VERSION="v0.8.0"
clusterctl init \
  --core cluster-api:${CAPI_VERSION} \
  --bootstrap kubeadm:${CAPI_VERSION} \
  --control-plane kubeadm:${CAPI_VERSION} \
  --infrastructure openstack:${CAPO_VERSION}
mnaser commented 1 year ago

@berendt I noticed that 1.5 is failing to provision new cluster, I haven't gotten around the root cause, I think it might be fixed in the recent commits. 1.4.x works fine, but you'll find out about 1.5 here

https://github.com/vexxhost/magnum-cluster-api/pull/216

mnaser commented 1 year ago

@berendt you should be good to go now with tip of branch, i'll release a new version soon with the fix :)

berendt commented 1 year ago

I haven't had time to continue yet. I will probably have time for the topic on Thursday.

berendt commented 1 year ago

@mnaser Is it possible to do the release today? We want to do some tests tomorrow and would be helpful to be able to work with the bug fix.

nguyenhuukhoi commented 11 months ago

Wrong image ID. It works with a correct image ID:

Request to create cluster template k8s-v1.27.5 accepted
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| insecure_registry     | -                                    |
| labels                | {'kube_tag': 'v1.27.5'}              |
| updated_at            | -                                    |
| floating_ip_enabled   | True                                 |
| fixed_subnet          | -                                    |
| master_flavor_id      | SCS-2V-4-10                          |
| uuid                  | df0e74af-6938-40a6-9062-2f9de3c316da |
| no_proxy              | -                                    |
| https_proxy           | -                                    |
| tls_disabled          | False                                |
| keypair_id            | -                                    |
| public                | False                                |
| http_proxy            | -                                    |
| docker_volume_size    | -                                    |
| server_type           | vm                                   |
| external_network_id   | public                               |
| cluster_distro        | ubuntu                               |
| image_id              | 929b90b6-202a-4651-b3d2-2b70e39d592f |
| volume_driver         | -                                    |
| registry_enabled      | False                                |
| docker_storage_driver | overlay2                             |
| apiserver_port        | -                                    |
| name                  | k8s-v1.27.5                          |
| created_at            | 2023-09-22T20:16:16+00:00            |
| network_driver        | calico                               |
| fixed_network         | -                                    |
| coe                   | kubernetes                           |
| flavor_id             | SCS-2V-4-10                          |
| master_lb_enabled     | True                                 |
| dns_nameserver        | 8.8.8.8                              |
| hidden                | False                                |
| tags                  | -                                    |
+-----------------------+--------------------------------------+

I started with the integration in Kolla-Ansible: https://review.opendev.org/c/openstack/kolla-ansible/+/896292.

With this patch and installed magnum-cluster-api plugin inside the magnum container images I have this error when trying to create the COE:

Cluster type (vm, Unset, kubernetes) not supported (HTTP 400) (Request-ID: req-71b9046a-61d2-498d-b0f4-243ce729f9cf)

I encountered this problem too. Can you share me solution for it. Thank you,

nguyenhuukhoi commented 11 months ago

Hello. my problem happened because magnum capi using image_id instead image name when we create cluster template.

nguyenhuukhoi commented 11 months ago

I added more details how make Magnum CAPI to work with Openstack

Requirements:

Install K8S cluster management

We setup a k8s cluster to manage workload clusters which were created by Magnum.

We need get /root/.kube/config from cluster management.

https://cluster-api.sigs.k8s.io/user/quick-start.html

Magnum

We need log in(as root) to magnum api and magnum conductor and install. docker exec -u root 'magnum container' /bin/bash

apt update
pip install magnum-cluster-api
wget https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz # We can choose other vervion
tar -zxvf helm-v3.13.2-linux-amd64.tar.gz 
mv linux-amd64/helm /usr/local/bin/

We need helm to make this work. Because There is no helm in magnum containers.

Copy /root/.kube/config from cluster management to magnum container under path /var/lib/magnum/.kube/config

How use Magnum CAPI

https://vexxhost.github.io/magnum-cluster-api/user/getting-started/

Feel free to ask me

mnaser commented 10 months ago

The progress to improve the Kolla support is in place:

nguyenhuukhoi commented 10 months ago

The progress to improve the Kolla support is in place:

Hello. Would we add helm in container as default?

mnaser commented 8 months ago

I think you're right, we are missing helm in there.

bartekle commented 5 months ago

Regarding proxy service (nice work there btw.), because I assume this also should be considered here in case of kolla-ansible type installation. Do you have some documentation about how this should be done?