问题现象:
# kubectl logs nova-compute-g4pnl -n openstack -c nova-compute
...
+ exec nova-compute --config-file /etc/nova/nova.conf --config-file /tmp/pod-shared/nova-vnc.ini --config-dir /opt/nova-compute/conf
Deprecated: Option "notification_format" from group "DEFAULT" is deprecated. Use option "notification_format" from group "notifications".
2023-07-11 20:06:08.393 1617 INFO os_vif [-] Loaded VIF plugins: linux_bridge, noop, ovs
2023-07-11 20:06:08.500 1617 WARNING oslo_config.cfg [req-fc476544-5edf-461a-bb5a-f3f8aee4bffe - - - - -] Deprecated: Option "heartbeat_in_pthread" from group "oslo_messaging_rabbit" is deprecated for removal. Its value may be silently ignored in the future.
2023-07-11 20:06:08.530 1617 CRITICAL nova [req-fc476544-5edf-461a-bb5a-f3f8aee4bffe - - - - -] Unhandled error: amqp.exceptions.AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.
2023-07-11 20:06:08.530 1617 ERROR nova Traceback (most recent call last):
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/bin/nova-compute", line 10, in
2023-07-11 20:06:08.530 1617 ERROR nova sys.exit(main())
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/nova/cmd/compute.py", line 59, in main
2023-07-11 20:06:08.530 1617 ERROR nova topic=compute_rpcapi.RPC_TOPIC)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/nova/service.py", line 256, in create
2023-07-11 20:06:08.530 1617 ERROR nova periodic_interval_max=periodic_interval_max)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/nova/service.py", line 115, in __init__
2023-07-11 20:06:08.530 1617 ERROR nova conductor_api.wait_until_ready(context.get_admin_context())
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/nova/conductor/api.py", line 68, in wait_until_ready
2023-07-11 20:06:08.530 1617 ERROR nova timeout=timeout)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/nova/baserpc.py", line 58, in ping
2023-07-11 20:06:08.530 1617 ERROR nova return cctxt.call(context, 'ping', arg=arg_p)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/rpc/client.py", line 179, in call
2023-07-11 20:06:08.530 1617 ERROR nova transport_options=self.transport_options)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/transport.py", line 128, in _send
2023-07-11 20:06:08.530 1617 ERROR nova transport_options=transport_options)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 682, in send
2023-07-11 20:06:08.530 1617 ERROR nova transport_options=transport_options)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 626, in _send
2023-07-11 20:06:08.530 1617 ERROR nova msg.update({'_reply_q': self._get_reply_q()})
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 607, in _get_reply_q
2023-07-11 20:06:08.530 1617 ERROR nova conn = self._get_connection(rpc_common.PURPOSE_LISTEN)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 598, in _get_connection
2023-07-11 20:06:08.530 1617 ERROR nova purpose=purpose)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/common.py", line 425, in __init__
2023-07-11 20:06:08.530 1617 ERROR nova self.connection = connection_pool.create(purpose)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/pool.py", line 146, in create
2023-07-11 20:06:08.530 1617 ERROR nova return self.connection_cls(self.conf, self.url, purpose)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/impl_rabbit.py", line 627, in __init__
2023-07-11 20:06:08.530 1617 ERROR nova self.ensure_connection()
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/oslo_messaging/_drivers/impl_rabbit.py", line 744, in ensure_connection
2023-07-11 20:06:08.530 1617 ERROR nova self.connection.ensure_connection(errback=on_error)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/kombu/connection.py", line 383, in ensure_connection
2023-07-11 20:06:08.530 1617 ERROR nova self._ensure_connection(*args, **kwargs)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/kombu/connection.py", line 439, in _ensure_connection
2023-07-11 20:06:08.530 1617 ERROR nova callback, timeout=timeout
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/kombu/utils/functional.py", line 325, in retry_over_time
2023-07-11 20:06:08.530 1617 ERROR nova return fun(*args, **kwargs)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/kombu/connection.py", line 866, in _connection_factory
2023-07-11 20:06:08.530 1617 ERROR nova self._connection = self._establish_connection()
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/kombu/connection.py", line 801, in _establish_connection
2023-07-11 20:06:08.530 1617 ERROR nova conn = self.transport.establish_connection()
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/kombu/transport/pyamqp.py", line 128, in establish_connection
2023-07-11 20:06:08.530 1617 ERROR nova conn.connect()
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/amqp/connection.py", line 329, in connect
2023-07-11 20:06:08.530 1617 ERROR nova self.drain_events(timeout=self.connect_timeout)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/amqp/connection.py", line 523, in drain_events
2023-07-11 20:06:08.530 1617 ERROR nova while not self.blocking_read(timeout):
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/amqp/connection.py", line 529, in blocking_read
2023-07-11 20:06:08.530 1617 ERROR nova return self.on_inbound_frame(frame)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/amqp/method_framing.py", line 53, in on_frame
2023-07-11 20:06:08.530 1617 ERROR nova callback(channel, method_sig, buf, None)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/amqp/connection.py", line 536, in on_inbound_method
2023-07-11 20:06:08.530 1617 ERROR nova method_sig, payload, content,
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/amqp/abstract_channel.py", line 143, in dispatch_method
2023-07-11 20:06:08.530 1617 ERROR nova listener(*args)
2023-07-11 20:06:08.530 1617 ERROR nova File "/usr/local/lib/python3.6/site-packages/amqp/connection.py", line 666, in _on_close
2023-07-11 20:06:08.530 1617 ERROR nova (class_id, method_id), ConnectionError)
2023-07-11 20:06:08.530 1617 ERROR nova amqp.exceptions.AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.
2023-07-11 20:06:08.530 1617 ERROR nova
root@rabbitmq-0:/# rabbitmqctl cluster_status
Cluster status of node [email protected] ...
Basics
Cluster name: [email protected]
Disk Nodes
[email protected]
[email protected]
[email protected]
Running Nodes
[email protected]
[email protected]
[email protected]
Versions
[email protected]: RabbitMQ 3.8.0 on Erlang 22.1.5
[email protected]: RabbitMQ 3.8.0 on Erlang 22.1.5
[email protected]: RabbitMQ 3.8.0 on Erlang 22.1.5
Alarms
(none)
Network Partitions
(none)
Listeners
Node: [email protected], interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: [email protected], interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: [email protected], interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: [email protected], interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: [email protected], interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: [email protected], interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: [email protected], interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: [email protected], interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: [email protected], interface: [::], port: 15672, protocol: http, purpose: HTTP API
Feature flags
Flag: drop_unroutable_metric, state: enabled
Flag: empty_basic_get_metric, state: enabled
Flag: implicit_default_bindings, state: enabled
Flag: quorum_queue, state: enabled
Flag: virtual_host_metadata, state: enabled
集群状态是好的
root@rabbitmq-0:/# rabbitmqctl list_users
Listing users ...
root@rabbitmq-0:/#
缺少用户
[root@node-1 ~]# kubectl get cm nova-etc -n openstack -o yaml | grep transport_url
transport_url = rabbit://rabbitmq:[email protected]:5672/
则 rabbitmq
是用户名;yHkxhtkD
是密码。
root@rabbitmq-0:/# rabbitmqctl add_user rabbitmq
Adding user "rabbitmq" ...
Password: yHkxhtkD
root@rabbitmq-0:/#
root@rabbitmq-0:/# rabbitmqctl add_vhost /
Adding vhost "/" ...
设置权限
root@rabbitmq-0:/# rabbitmqctl set_permissions rabbitmq ".*" ".*" ".*"
Setting permissions for user "rabbitmq" in vhost "/" ...
root@rabbitmq-0:/#
设置 rabbitmq 用户 administrator tag
root@rabbitmq-0:/# rabbitmqctl set_user_tags rabbitmq administrator
Setting tags for user "rabbitmq" to [administrator] ...
root@rabbitmq-0:/#
再次检查问题 pod,可以正常连接 rabbitmq,并启动成功。