-
Notifications
You must be signed in to change notification settings - Fork 385
Expose server gossip and RPC ports as hostPorts #740
Conversation
683f7dd
to
adcd357
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! I haven't tried it out yet but have some minor code comments.
adcd357
to
dc72814
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!!
It is probably unnecessary since you have the bats tests, but I'm curious if it would make any sense to add an acceptance test which covers setting these flags in an environment which would consume them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work. I didn't test with a VM but I did test on k8s and ensured that the ports and ips were as expected.
Will also need changelog and helm docs updates :D |
dc72814
to
664b8ce
Compare
@kschoche It would involve setting up some VM infrastructure in our tests and probably passing some ssh keys in which seems doable and maybe worth it if we feel like there's a gap in our automated testing. Maybe a criteria we could use to decide when to prioritize writing an acceptance test is if a bug comes up involving external clients/servers? |
Yeah, mostly curious what you thought on it! I looked into it briefly this morning, and there's some tf bits we could grab from hashicorp/consul that would probably do the trick. Right now we have no automated testing which involves VM / k8s federation, but I suppose that is a configuration which is much more reliant on the actual configuration than whether or not one of the dc are VM or not, so an automated test would be kinda moot. Great work! |
6031a41
to
e4b4f9b
Compare
b104b73
to
744b85c
Compare
To enable a client agent outside of the k8s cluster to join the datacenter, you would need to enable server.exposeGossipAndRPCPorts, client.exposeGossipPorts, and set server.ports.serflan.port to a port not being used on the host. Since client.exposeGossipPorts uses the hostPort 8301, server.ports.serflan.port must be set to something other than 8301. The client agent VM outside of the k8s cluster would need to be able to route to the private IP of the VMs in the k8s cluster to join the datacenter and the VMs in the k8s cluster would need to be able to route to the client agent VM outside the k8s cluster as well on its advertised IP.
744b85c
to
1eefad8
Compare
Changes proposed
server.ports.serflan.port
. This would be necessary to configure differently when exposing both server.exposeGossipAndRPCPorts and client.exposeGossipPorts to avoid port conflicts when client and servers are running on the same node.Use Case
To enable a client agent outside of the k8s cluster to join the datacenter, you would need to enable server.exposeGossipAndRPCPorts, client.exposeGossipPorts, and set server.ports.serflan.port to a port not being used on the host. Since client.exposeGossipPorts uses the hostPort 8301, server.ports.serflan.port must be set to something other than 8301, if those client/server pods can be scheduled on the same node.
How I've tested
On GCP:
gcloud container clusters create external-agent --project nitya-293720 --cluster-version="1.17.12-gke.2502" --zone us-west1-a --machine-type=n1-standard-4 --num-nodes 3
values.yaml
wget https://releases.hashicorp.com/consul/1.9.0/consul_1.9.0_linux_amd64.zip && unzip consul_1.9.0_linux_amd64.zip
-advertise
ip with the internal ip of your VM. Replace the-retry-join
with thestatus.hostIP
on your consul server pod. If you have multiple consul servers, you will need multiple of these lines with each ip:port of a consul server. Create a folder calledlocal/consul/config
andlocal/consul/data
.-retry-join 'provider=k8s host_network=true label_selector="app=consul,component=server"'
instead rather than hardcoding potentially multiple consul server IPs.payload.json
curl http://127.0.0.1:8500/v1/catalog/services
and verify you see the service.How I expect reviewers to test
If at least one reviewer has the bandwidth to run through the complete steps above it would give some confidence in catching any gotchas we might want to document.