Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpk config set redpanda.advertised_kafka_api when using NAT #5498

Closed
freef4ll opened this issue Jul 18, 2022 · 4 comments · Fixed by #5522
Closed

rpk config set redpanda.advertised_kafka_api when using NAT #5498

freef4ll opened this issue Jul 18, 2022 · 4 comments · Fixed by #5522
Assignees
Labels
area/rpk community kind/bug Something isn't working

Comments

@freef4ll
Copy link

Version & Environment

Redpanda version: (use rpk version):

$ rpk version
v22.1.4 (rev 491e569)

What went wrong?

While setting up a multi data centre cluster under AWS, ran into an issue of joining one region to the other. If the advertised_kafka_api is left empty the cluster doesn't join because https://github.com/redpanda-data/deployment-automation/tree/main/aws uses the default VPC which means both regions have the 172.31.0.0/16 CIDR space and cannot communicate. Hence need to communicate with one region over public IP:

rpk config set cluster_id 'redpanda'
rpk config set organization 'redpanda-test'
rpk mode production
rpk config bootstrap --id 4 --self 0.0.0.0 --ips 13.53.123.166,13.53.190.19,13.53.36.47 # or 172.31.21.184

Setting the public IP causes an error like:

rpk config set redpanda.advertised_kafka_api '{ address: 3.250.158.1, port: 9092}' --format yaml

ERROR 2022/07/18 10:47:38 svType != tvType; key=advertised_kafka_api, st=map[string]interface {}, tt=[]interface {}, sv=map[address:3.250.158.1 port:9092], tv=[map[address:172.31.21.184 port:9092]]      

What should have happened instead?

The IP possibly should be allowed, if the configuration file is edited by hand to add this IP, cluster is able to start up and communicate.

How to reproduce the issue?

Set the advertised_kafka_api to an IP that doesn't exist on the server locally.

@freef4ll freef4ll added the kind/bug Something isn't working label Jul 18, 2022
@r-vasquez
Copy link
Contributor

Can you try adding [] to the value, (redpanda.advertised_kafka_api is a list) :

$ rpk config set redpanda.advertised_kafka_api '{address: 3.250.158.1, port: 9092}' --format yaml 
ERROR 2022/07/19 11:51:11 svType != tvType; key=advertised_kafka_api, st=map[string]interface {}, tt=[]interface {}, sv=map[address:3.250.158.1 port:9092], tv=[map[address:3.250.158.1 port:9092]]

$ rpk config set redpanda.advertised_kafka_api '[{address: 3.250.158.1, port: 9092}]' --format yaml

$ cat /etc/redpanda/redpanda.yaml
config_file: /etc/redpanda/redpanda.yaml
pandaproxy: {}
redpanda:
  admin:
  - address: 0.0.0.0
    port: 9644
  advertised_kafka_api:
  - address: 3.250.158.1
    port: 9092

Please confirm that this solved your problem so we can close the issue.

Also, in the upcoming v22.2 we will improve the error message to:

$ rpk config set redpanda.advertised_kafka_api '{address: 3.250.158.1, port: 9023}' --format yaml
unable to set "redpanda.advertised_kafka_api":yaml: unmarshal errors:
  line 1: cannot unmarshal !!map into []config.NamedSocketAddress

And we have a follow-up issue to let the users set a single value in a slice: #5264

@twmb
Copy link
Contributor

twmb commented Jul 20, 2022

The above will be possible in v22.2.1

@freef4ll
Copy link
Author

Thanks! Wrapping the yaml inside '[]' helps.

Should the Ansible script be updated to also use this syntax?

Strangely, for redpanda.advertised_rpc_api it is not needed and stock one works but not the suggested one:

# rpk config set redpanda.advertised_rpc_api '[{address: 3.250.204.236, port: 9092}]' --format yaml
ERROR 2022/07/20 10:31:05 svType != tvType; key=advertised_rpc_api, st=[]interface {}, tt=map[string]interface {}, sv=[map[address:3.250.204.236 port:9092]], tv=map[address:3.250.204.236 port:33145]

# rpk config set redpanda.advertised_rpc_api '{address: 3.250.204.236, port: 9092}' --format yaml

@twmb
Copy link
Contributor

twmb commented Jul 20, 2022

The advertised_rpc_api is actually a single element and not a list of hosts to advertise:

AdvertisedRPCAPI *SocketAddress `yaml:"advertised_rpc_api,omitempty" json:"advertised_rpc_api,omitempty"`

trying to set a single element with an array will continue to fail, I'm not sure we should modify that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rpk community kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants