Skip to content

cephadm: set Grafana http_addr to 0.0.0.0 when unset - #69080

Merged
rkachach merged 1 commit into
ceph:mainfrom
kginonredhat:issue-75365-Grafana-container-fails-to-start-reject-localhost
Jun 12, 2026
Merged

rkachach merged 1 commit into
ceph:mainfrom
kginonredhat:issue-75365-Grafana-container-fails-to-start-reject-localhost

Conversation

@kginonredhat

@kginonredhat kginonredhat commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Grafana 11.1+ rejects non-literal http_addr values (e.g. localhost) in grafana-apiserver.

Use 0.0.0.0 by default; stop bracket-wrapping IPv6 addresses in http_addr.
Fixes: https://tracker.ceph.com/issues/75365
Signed-off-by: Kobi Ginon [email protected]

Verification steps:

On a running ceph cluster define grafana configuration
pin it to a node where we can find the grafana.ini value
in y case it is ceph-node-0:

[ceph: root@ceph-node-0 /]# cat graphana.yaml
service_type: grafana
placement:
  hosts:
    - ceph-node-0
spec:
  protocol: https
  anonymous_access: true
  
  [ceph: root@ceph-node-0 /]# ceph orch apply -i graphana.yaml
Scheduled grafana update...

get out of the cephadmshell to the host 
[root@ceph-node-0 grafana]# cd /var/lib/ceph/fd6b0566-5835-11f1-829b-52540006a93f/grafana.ceph-node-0/etc/
replace fd6b0566-5835-11f1-829b-52540006a93f with your ceph fsid
replace folder name grafana.ceph-node-0 with grafana.<ceph node name>

[root@ceph-node-0 etc]# grep -B 6 http_addr grafana/grafana.ini
[server]
  domain = 'ceph-node-0'
  protocol = https
  cert_file = /etc/grafana/certs/cert_file
  cert_key = /etc/grafana/certs/cert_key
  http_port = 3000
  **http_addr = 0.0.0.0**

if the value confirmed to be 0.0.0.0 then it is OK 
Can extend the validation to real listenning port also and adress *
[root@ceph-node-0 etc]# podman ps | grep grafana
f1966090866c  quay.io/ceph/grafana:12.3.1                                                                                                   18 minutes ago  Up 18 minutes  3000/tcp    ceph-fd6b0566-5835-11f1-829b-52540006a93f-grafana-ceph-node-0
[root@ceph-node-0 etc]# ss -tlnp | grep 3000
LISTEN 0      4096                 *:3000            *:*    users:(("grafana",pid=36856,fd=14))

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@kginonredhat

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@kginonredhat
kginonredhat requested a review from rkachach May 26, 2026 14:18

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kginonredhat for working on this. The changes as they are right now will berak IPv6 support. Can you plz update the code and test the new changes work both for ipv4 and ipv6?

Comment on lines +77 to +80
if ipaddress.ip_network(grafana_ip).version == 6:
grafana_ip = f"[{grafana_ip}]"

if not grafana_ip:
# Grafana 11.1+ validates http_addr with net.ParseIP; hostnames such as
# localhost fail in grafana-apiserver. Use a literal address (bind all IPv4).
grafana_ip = '0.0.0.0'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change will break the ipv6 support

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @rkachach
this line for ipv6 became redundant since if not grafana_ip we are listening on '0.0.0.0' regardless of ipv6 or not.
and setting grafana_ip will be set if set in the yaml.
Anyway i will double check those 2 situation on ipv6 setup and will update here shortly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without setting the grafana_ip

[ceph: root@ceph-node-0 /]# cat /mnt/graphana.yaml
service_type: grafana
placement:
hosts:
- ceph-node-0
spec:
protocol: https
anonymous_access: true

ceph orch host ls[ceph: root@ceph-node-0 /]# ceph orch host ls
HOST ADDR LABELS STATUS
ceph-node-0 2620:52:0:1304::64 _admin
ceph-node-1 2620:52:0:1304::65
ceph-node-2 2620:52:0:1304::66
3 hosts in cluster

[ceph: root@ceph-node-0 /]# ceph orch ls grafana
NAME PORTS RUNNING REFRESHED AGE PLACEMENT
grafana ?:3000 1/1 2m ago 5m ceph-node-0

[root@ceph-node-0 ~]# ss -tlnp | grep 3000
LISTEN 0 4096 *:3000 : users:(("grafana",pid=19516,fd=20))

@kginonredhat
kginonredhat force-pushed the issue-75365-Grafana-container-fails-to-start-reject-localhost branch from 42a1317 to 18b1ee8 Compare May 31, 2026 11:19
@kginonredhat
kginonredhat requested a review from rkachach May 31, 2026 11:22
Comment on lines -77 to -78
if ipaddress.ip_network(grafana_ip).version == 6:
grafana_ip = f"[{grafana_ip}]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering why are we deleting this line? isn't this the normal workflow when a grafana ipv6 is defined?

@kginonredhat

Copy link
Copy Markdown
Contributor Author

hi @ShwetaBhosale1
per our conversation checking ipv6 to check that the flow works as expected and those 2 lines are not needed

Steps below

[ceph: root@ceph-node-0 /]# ceph orch host ls
HOST ADDR LABELS STATUS
ceph-node-0 2620:52:0:1304::64 _admin
ceph-node-1 2620:52:0:1304::65
ceph-node-2 2620:52:0:1304::66
3 hosts in cluster

[ceph: root@ceph-node-0 /]# cat /mnt/grafana-ipv6-bind.yaml
service_type: grafana
service_name: grafana
placement:
hosts:

  • ceph-node-0
    networks:

2620:52:0:1304::/64
spec:
only_bind_port_on_networks: true
protocol: http
port: 3000
anonymous_access: true
[ceph: root@ceph-node-0 /]# ceph orch apply -i /mnt/grafana-ipv6-bind.yaml

[ceph: root@ceph-node-0 /]# ceph orch ps --service_name grafana
NAME HOST PORTS STATUS REFRESHED AGE MEM USE MEM LIM VERSION IMAGE ID CONTAINER ID
grafana.ceph-node-0 ceph-node-0 2620:52:0:1304::64:3000 running (22s) 19s ago 22s 35.2M - 12.3.1 5cdab57891ea d3c80ad4475f

checking on the host ceph-node-0 http_addr
[root@ceph-node-0 ~]# FSID=$(cephadm shell ceph fsid)

[root@ceph-node-0 ~]# DAEMON=$(cephadm shell -- ceph orch ps --hostname ceph-node-0 --service_name grafana --format json | jq -r '.[0].daemon_id')

Validating it has no square brackets
[root@ceph-node-0 ~]# cat /var/lib/ceph/${FSID}/grafana.${DAEMON}/etc/grafana/grafana.ini | grep -E 'http_addr|^ http_port|^ protocol'
protocol = http
http_port = 3000
http_addr = 2620:52:0:1304::64

[root@ceph-node-0 ~]# ss -tlnp | grep 3000
LISTEN 0 4096 [2620:52:0:1304::64]:3000 [::]:* users:(("grafana",pid=27164,fd=15))

another check with default , first deleting the previous

[root@ceph-node-0 ~]# cephadm shell -m /mnt/
Inferring fsid cd7a811e-6006-11f1-b4dd-5254009bd455
Inferring config /var/lib/ceph/cd7a811e-6006-11f1-b4dd-5254009bd455/mon.ceph-node-0/config
cecep[ceph: root@ceph-node-0 /]# ceph orch rm grafana
Removed service grafana

[ceph: root@ceph-node-0 /]# cat /mnt/grafana-default.yaml
service_type: grafana
service_name: grafana
placement:
hosts:

  • ceph-node-0
    spec:
    protocol: http
    port: 3000
    anonymous_access: true

[ceph: root@ceph-node-0 /]# ceph orch apply -i /mnt/grafana-default.yaml
Scheduled grafana update...

check Listen on all addresses
[ceph: root@ceph-node-0 /]# ceph orch ps --service_name grafana
NAME HOST PORTS STATUS REFRESHED AGE MEM USE MEM LIM VERSION IMAGE ID CONTAINER ID
grafana.ceph-node-0 ceph-node-0 *:3000 running (11s) 7s ago 39s 103M - 12.3.1 5cdab57891ea 6879472ce067
[ceph: root@ceph-node-0 /]#
exit
[root@ceph-node-0 ~]# cat /var/lib/ceph/${FSID}/grafana.${DAEMON}/etc/grafana/grafana.ini | grep -E 'http_addr|^ http_port|^ protocol'
protocol = http
http_port = 3000
http_addr = ::

[root@ceph-node-0 ~]# ss -tlnp | grep 3000
LISTEN 0 4096 *:3000 : users:(("grafana",pid=35498,fd=12))

@ShwetaBhosale1

Copy link
Copy Markdown
Contributor

jenkins test make check

@ShwetaBhosale1

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

Grafana 11.1+ rejects non-literal http_addr values (e.g. localhost)
in grafana-apiserver. Use 0.0.0.0 by default; stop bracket-wrapping
IPv6 addresses in http_addr.
Fixes: https://tracker.ceph.com/issues/75365
Signed-off-by: Kobi Ginon <[email protected]>
@kginonredhat
kginonredhat force-pushed the issue-75365-Grafana-container-fails-to-start-reject-localhost branch from 18b1ee8 to c8ffac9 Compare June 5, 2026 16:33
@kginonredhat

kginonredhat commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor Author

jenkins test api

3 similar comments
@kginonredhat

Copy link
Copy Markdown
Contributor Author

jenkins test api

@kginonredhat

Copy link
Copy Markdown
Contributor Author

jenkins test api

@kginonredhat

Copy link
Copy Markdown
Contributor Author

jenkins test api

@kginonredhat

Copy link
Copy Markdown
Contributor Author

jenkins test api
i hope someone already fixed the api test in main
trying again

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rkachach

Copy link
Copy Markdown
Contributor

@rkachach
rkachach merged commit ace8eb0 into ceph:main Jun 12, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/27410360887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants