Skip to content
This repository was archived by the owner on Aug 25, 2021. It is now read-only.

Server wan ports #839

Merged
merged 4 commits into from
Feb 23, 2021
Merged

Server wan ports #839

merged 4 commits into from
Feb 23, 2021

Conversation

lkysow
Copy link
Member

@lkysow lkysow commented Feb 22, 2021

It turns out that we do need to expose the server wan port as a host port when the advertise IP is the node IP in order for the /operator/keyring to work. There may be other reasons as well but we know this doesn't work without it.

Changes proposed in this PR:

  • refactor YAML for ports so the name of the port is at the top so it's easier to parse
  • split out serfwan into serfwan-tcp and serfwan-udp (similar to serflan-tcp/udp) because when exposed as a hostPort if the UDP protocol port doesn't exist then the /operator/keyring API fails
  • expose serfwan as a host port when server.exposeGossipAndRPCPorts is true

FIxes #838, re-opens and concludes #762.

How I've tested this PR:

  • kubectl create secret generic consul-gossip-encryption-key --from-literal=key=$(consul keygen)

  • Use values.yaml

    global:
      name: consul
      enabled: false
      gossipEncryption:
        secretName: consul-gossip-encryption-key
        secretKey: key
    server:
      enabled: true
      exposeGossipAndRPCPorts: true
      replicas: 1
  • Install with latest helm chart

  • Run kubectl exec consul-server-0 -- curl -sS localhost:8500/v1/operator/keyring

    • You'll get an error
  • Uninstall

  • Install with this branch

  • Run kubectl exec consul-server-0 -- curl -sS localhost:8500/v1/operator/keyring

    • It will succeed

How I expect reviewers to test this PR:

  • See above

Checklist:

  • Bats tests added
  • CHANGELOG entry added (HashiCorp engineers only, community PRs should not add a changelog entry)

This is needed because in some cases Kubernetes will refuse udp traffic.
When `server.exposeGossipAndRPCPorts` is true, expose server's serf WAN
port as a host port on 8302. This is needed for specific cases where
serf attempts to use the WAN network because the advertise IP is the
host IP and so it will attempt to use hostIP and 8302.

This port does not need to be configurable (unlike serf LAN) because
clients don't expose a serf WAN port, only servers and so it won't
collide with client ports.
@lkysow lkysow marked this pull request as ready for review February 22, 2021 22:30
@lkysow lkysow requested review from a team, kschoche and thisisnotashwin and removed request for a team February 22, 2021 22:30
UDP traffic would not be routed properly.

In addition, if `server.exposeGossipAndRPCPorts` is true, expose the WAN port
(`8302`) as a host port. [[GH-839](https://github.com/hashicorp/consul-helm/pull/839)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, were you able to see any error logs without this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, only the failing of the API call.

Copy link

@thisisnotashwin thisisnotashwin left a comment

Choose a reason for hiding this comment

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

💥 nice

Copy link
Contributor

@ndhanushkodi ndhanushkodi left a comment

Choose a reason for hiding this comment

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

Looks great to me!!

Copy link
Contributor

@kschoche kschoche left a comment

Choose a reason for hiding this comment

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

🔥

@lkysow lkysow merged commit ae54c22 into master Feb 23, 2021
@lkysow lkysow deleted the server-wan-ports branch February 23, 2021 17:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

keyring api is not working with server.exposeGossipAndRPCPorts and client.exposeGossipAndPorts
4 participants