Using sunbeam to deploy openstack (by quqi99)

作者:张华 发表于:2023-10-15
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明(http://blog.csdn.net/quqi99)

What’s sunbeam

sunbeam是一个部署openstack的工具,它会用juju定义两个clouds(microk8s and sunbeam), microk8s用于部署openstack控制服务(位于openstack model), sunbeam用于部署sunbeam-controller(位于admin/conroller model):

  • openstack控制面部署在microk8s中
  • openstack数据面(ovn and nova-compute)用snap部署(openstack-hypervisor)

Using sunbeam to deploy openstack (by quqi99)_第1张图片

Deploy sunbeam

juju add sunbean && juju add-machine --series jammy --constraints "root-disk=100G mem=32G cores=8"
juju ssh 0
sudo snap install openstack --channel 2023.1
python3 -c "import socket; print(socket.getfqdn())"
sunbeam prepare-node-script | bash -x
sudo usermod -a -G snap_daemon $USER && newgrp snap_daemon
#ERROR failed to bootstrap model: machine is already provisioned
sudo remove-juju-services
sunbeam cluster bootstrap --accept-defaults
mkdir -p ~/.kube && sudo chown -R $USER ~/.kube
sudo usermod -a -G snap_microk8s $USER && newgrp snap_microk8s
microk8s.kubectl get pods --all-namespaces
microk8s.ctr --namespace k8s.io image ls
#registry.k8s.io, docker.io, registry.jujucharms.com, quay.io
##echo 'HTTPS_PROXY=http://192.168.99.186:9311' |sudo tee -a /var/snap/microk8s/current/args/containerd-env
microk8s.ctr --namespace k8s.io containers ls
alias kubectl='sudo /snap/bin/microk8s.kubectl'
source <(kubectl completion bash) && kubectl completion bash |sudo tee /etc/bash_completion.d/kubectl
sunbeam cluster list
#Unable to complete operation for new subnet. The number of DNS nameservers exceeds the limit 5.
sunbeam configure --accept-defaults --openrc demo-openrc
sunbeam openrc > admin-openrc
sunbeam launch ubuntu --name test
sudo journalctl -u snap.openstack.clusterd.service -f
openstack hypervisor list
sudo snap get openstack-hypervisor node
sudo snap logs openstack-hypervisor.hypervisor-config-service
sudo snap logs openstack-hypervisor.ovn-controller
#juju switch opensetack && juju ssh ovn-central/0
sudo microk8s.kubectl -n openstack exec -it ovn-central-0 bash
sudo microk8s.kubectl -n openstack exec -it ovn-central-0 -c ovn-northd -- ovn-sbctl --db=ssl:ovn-central-0.ovn-central-endpoints.openstack.svc.cluster.local:16642 -c /etc/ovn/cert_host -C /etc/ovn/ovn-central.crt -p /etc/ovn/key_host list
cat /var/snap/openstack-hypervisor/common/etc/nova/nova.conf

Some Info

juju ssh -m admin/controller 0
ubuntu@juju-5d90c3-sunbeam-0:~$ juju clouds |tail -n2
Only clouds with registered credentials are shown.
There are more clouds, use --all to see them.
microk8s   1        localhost  k8s     0            built-in  A Kubernetes Cluster
sunbeam    1        default    manual  0            local     
ubuntu@juju-5d90c3-sunbeam-0:~$ juju controllers |tail -n1
sunbeam-controller*  admin/controller  juju-5d90c3-sunbeam-0.cloud.sts  superuser                     2      -   -  3.2.0
ubuntu@juju-5d90c3-sunbeam-0:~$ juju models |tail -n3
Model              Cloud/Region                Type        Status     Machines  Cores  Units  Access  Last connection
admin/controller*  sunbeam/default             manual      available         1      8  4      admin   just now
openstack          sunbeam-microk8s/localhost  kubernetes  available         0      -  24     admin   1 minute ago

ubuntu@juju-5d90c3-sunbeam-0:~$ kubectl get pods --all-namespaces
NAMESPACE        NAME                                       READY   STATUS    RESTARTS        AGE
metallb-system   speaker-2rspk                              1/1     Running   0               108m
kube-system      coredns-6f5f9b5d74-ctc9d                   1/1     Running   0               109m
kube-system      calico-node-m74rh                          1/1     Running   0               107m
metallb-system   controller-9556c586f-kqslx                 1/1     Running   0               108m
kube-system      calico-kube-controllers-7457875fc6-xdst9   1/1     Running   0               106m
openstack        modeloperator-7f5fcd7474-w2f5p             1/1     Running   0               105m
openstack        cinder-ceph-mysql-router-0                 2/2     Running   0               105m
openstack        ovn-relay-0                                2/2     Running   0               105m
openstack        certificate-authority-0                    1/1     Running   0               104m
openstack        horizon-mysql-router-0                     2/2     Running   1 (101m ago)    105m
openstack        horizon-0                                  2/2     Running   0               105m
openstack        keystone-mysql-router-0                    2/2     Running   0               104m
openstack        cinder-ceph-0                              2/2     Running   0               105m
openstack        rabbitmq-0                                 2/2     Running   0               105m
openstack        placement-0                                2/2     Running   0               104m
openstack        neutron-0                                  2/2     Running   0               104m
openstack        keystone-0                                 2/2     Running   0               105m
openstack        glance-0                                   2/2     Running   1 (91m ago)     104m
openstack        traefik-0                                  2/2     Running   0               105m
openstack        cinder-mysql-router-0                      2/2     Running   2 (41m ago)     105m
openstack        neutron-mysql-router-0                     2/2     Running   2 (35m ago)     104m
openstack        nova-api-mysql-router-0                    2/2     Running   2 (10m ago)     104m
openstack        cinder-0                                   3/3     Running   1 (8m43s ago)   104m
kube-system      hostpath-provisioner-69cd9ff5b8-kdjpp      1/1     Running   5 (7m22s ago)   108m
openstack        nova-mysql-router-0                        2/2     Running   3 (7m19s ago)   105m
openstack        nova-0                                     4/4     Running   2 (7m19s ago)   103m
openstack        glance-mysql-router-0                      2/2     Running   1 (7m19s ago)   104m
openstack        ovn-central-0                              4/4     Running   2 (5m51s ago)   103m
openstack        nova-cell-mysql-router-0                   2/2     Running   1 (4m38s ago)   105m
openstack        mysql-0                                    2/2     Running   1 (3m21s ago)   104m
openstack        placement-mysql-router-0                   2/2     Running   3 (7m19s ago)   104m


ubuntu@juju-5d90c3-sunbeam-0:~$ juju switch admin/controller
sunbeam-controller:juju-5d90c3-sunbeam-0.cloud.sts/openstack -> sunbeam-controller:admin/controller
ubuntu@juju-5d90c3-sunbeam-0:~$ juju status
Model       Controller          Cloud/Region     Version  SLA          Timestamp  Notes
controller  sunbeam-controller  sunbeam/default  3.2.0    unsupported  03:50:49Z  upgrade available: 3.2.3
SAAS                   Status   Store  URL
certificate-authority  active   local  juju-5d90c3-sunbeam-0.cloud.sts/openstack.certificate-authority
keystone               waiting  local  juju-5d90c3-sunbeam-0.cloud.sts/openstack.keystone
ovn-relay              active   local  juju-5d90c3-sunbeam-0.cloud.sts/openstack.ovn-relay
rabbitmq               active   local  juju-5d90c3-sunbeam-0.cloud.sts/openstack.rabbitmq
App                   Version  Status   Scale  Charm                 Channel        Rev  Exposed  Message
controller                     active       1  juju-controller       3.2/stable      14  no       
microceph                      unknown      0  microceph             edge             9  no       
microk8s                       active       1  microk8s              legacy/stable  121  no       
openstack-hypervisor           active       1  openstack-hypervisor  2023.1/stable  105  no       
sunbeam-machine                active       1  sunbeam-machine       latest/edge      1  no       
Unit                     Workload  Agent  Machine  Public address  Ports      Message
controller/0*            active    idle   0        10.5.1.11                  
microk8s/0*              active    idle   0        10.5.1.11       16443/tcp  
openstack-hypervisor/0*  active    idle   0        10.5.1.11                  
sunbeam-machine/0*       active    idle   0        10.5.1.11                  
Machine  State    Address    Inst id  Base          AZ  Message
0        started  10.5.1.11  manual:  [email protected]      Manually provisioned machine
Offer      Application  Charm      Rev  Connected  Endpoint  Interface    Role
microceph  microceph    microceph  9    0/0        ceph      ceph-client  provider

ubuntu@juju-5d90c3-sunbeam-0:~$ juju switch openstack
sunbeam-controller:admin/controller -> sunbeam-controller:juju-5d90c3-sunbeam-0.cloud.sts/openstack
ubuntu@juju-5d90c3-sunbeam-0:~$ juju status                                                                                                                                            
Model      Controller          Cloud/Region                Version  SLA          Timestamp                                                                                             
openstack  sunbeam-controller  sunbeam-microk8s/localhost  3.2.0    unsupported  03:56:29Z
App                       Version                  Status       Scale  Charm                      Channel        Rev  Address         Exposed  Message                                 
certificate-authority                              active           1  tls-certificates-operator  latest/stable   22  10.152.183.253  no                                               
cinder                                             waiting          1  cinder-k8s                 2023.1/stable   47  10.152.183.47   no       installing agent                        
cinder-ceph                                        waiting          1  cinder-ceph-k8s            2023.1/stable   38  10.152.183.65   no       installing agent                        
cinder-ceph-mysql-router  8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.165  no                                               
cinder-mysql-router       8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.124  no                                               
glance                                             active           1  glance-k8s                 2023.1/stable   59  10.152.183.202  no                                               
glance-mysql-router       8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.77   no                                               
horizon                                            active           1  horizon-k8s                2023.1/stable   56  10.152.183.234  no       http://10.20.21.10/openstack-horizon    
horizon-mysql-router      8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.218  no                                               
keystone                                           waiting          1  keystone-k8s               2023.1/stable  125  10.152.183.123  no       installing agent                        
keystone-mysql-router     8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.78   no                                               
mysql                     8.0.34-0ubuntu0.22.04.1  active           1  mysql-k8s                  8.0/candidate   99  10.152.183.183  no                                               
neutron                                            waiting          1  neutron-k8s                2023.1/stable   53  10.152.183.187  no       installing agent                        
neutron-mysql-router      8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.45   no                                               
nova                                               waiting          1  nova-k8s                   2023.1/stable   48  10.152.183.59   no       installing agent                        
nova-api-mysql-router     8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.46   no                                               
nova-cell-mysql-router    8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.194  no                                               
nova-mysql-router         8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.110  no                                               
ovn-central                                        active           1  ovn-central-k8s            23.03/stable    61  10.152.183.195  no                                               
ovn-relay                                          active           1  ovn-relay-k8s              23.03/stable    49  10.20.21.11     no                                               
placement                                          active           1  placement-k8s              2023.1/stable   43  10.152.183.90   no       
placement-mysql-router    8.0.34-0ubuntu0.22.04.1  active           1  mysql-router-k8s           8.0/candidate   64  10.152.183.210  no       
rabbitmq                  3.9.13                   active           1  rabbitmq-k8s               3.9/stable      30  10.20.21.12     no       
traefik                   2.10.4                   maintenance      1  traefik-k8s                1.0/candidate  148  10.20.21.10     no       updating ingress configuration for 'ingress:48'
Unit                         Workload     Agent  Address      Ports  Message
certificate-authority/0*     active       idle   10.1.105.20         
cinder-ceph-mysql-router/0*  active       idle   10.1.105.9          
cinder-ceph/0*               blocked      idle   10.1.105.12         (ceph) integration missing
cinder-mysql-router/0*       active       idle   10.1.105.7          
cinder/0*                    waiting      idle   10.1.105.30         (workload) Not all relations are ready
glance-mysql-router/0*       active       idle   10.1.105.19         
glance/0*                    active       idle   10.1.105.35         
horizon-mysql-router/0*      active       idle   10.1.105.11         
horizon/0*                   active       idle   10.1.105.13         
keystone-mysql-router/0*     active       idle   10.1.105.25         
keystone/0*                  waiting      idle   10.1.105.22         (workload) Not all relations are ready
mysql/0*                     active       idle   10.1.105.36         Primary
neutron-mysql-router/0*      active       idle   10.1.105.26         
neutron/0*                   waiting      idle   10.1.105.29         (workload) Not all relations are ready
nova-api-mysql-router/0*     active       idle   10.1.105.21         
nova-cell-mysql-router/0*    active       idle   10.1.105.18         
nova-mysql-router/0*         active       idle   10.1.105.8          
nova/0*                      waiting      idle   10.1.105.31         (workload) Not all relations are ready
ovn-central/0*               active       idle   10.1.105.37         
ovn-relay/0*                 active       idle   10.1.105.10         
placement-mysql-router/0*    active       idle   10.1.105.28         
placement/0*                 active       idle   10.1.105.27         
rabbitmq/0*                  active       idle   10.1.105.23         
traefik/0*                   maintenance  idle   10.1.105.24         updating ingress configuration for 'ingress:48'
Offer                  Application            Charm                      Rev  Connected  Endpoint              Interface             Role
certificate-authority  certificate-authority  tls-certificates-operator  22   1/1        certificates          tls-certificates      provider
keystone               keystone               keystone-k8s               125  1/1        identity-credentials  keystone-credentials  provider
ovn-relay              ovn-relay              ovn-relay-k8s              49   1/1        ovsdb-cms-relay       ovsdb-cms             provider
rabbitmq               rabbitmq               rabbitmq-k8s               30   1/1        amqp                  rabbitmq              provider

Reference

[1] Sunbeam underlying projects - https://discourse.ubuntu.com/t/sunbeam-underlying-projects/37526

你可能感兴趣的:(sunbeam,openstack)