Skip to content

Known issue: connection refused due to IPVS #138

Open
@alexellis

Description

Details

You may run into a known issue where the client deployment for the inlets tunnel says: connection refused

Why does this happen?

This is due to the way your Kubernetes cluster or networking driver is configured to use IPVS. In IPVS mode, outgoing traffic is redirected to the node that the pod is running on, instead of being allowed to go to your exit-server.

Most clusters use iptables, which do not cause this problem.

If you've installed Calico or configured Cilium in a certain way then it may be using IPVS.

Possible Solution

There is a workaround, which is better for production use because the token and IP of the tunnel are deterministic, and the inlets-pro helm chart can be managed through a GitOps approach using Argo or FluxCD.

  • Provision an exit-server using inletsctl, terraform, or manually
  • Then deploy the inlets-pro client using its helm chart

If anyone has suggestions on how to improve the operator so that when an external-ip is set, it can be compatible with IPVS, I'd love to hear from you here or in some other way.

Full details: https://inlets.dev/blog/2021/07/08/short-lived-clusters.html

If you want to carry on using the operator for some reason, edit the service and remove its public IP. You'll be able to see the IPs using kubectl get tunnels -A -o wide

Steps to Reproduce (for bugs)

Optionally create a multipass VM, or cloud VM:

multipass launch --cpus 2 --mem 4G -d 30G --name k3s-server
multipass exec k3s-server /bin/bash

curl -sLS https://get.arkade.dev| sudo sh
arkade get k3sup && sudo mv .arkade/bin/k3sup /usr/local/bin/
  1. Launch a cluster in IPVS mode k3sup install --local --k3s-extra-args="--kube-proxy-arg proxy-mode=ipvs"
  2. export KUBECONFIG=$(pwd)/kubeconfig
    1. Or install a networking driver which uses IPVS.
  3. Install IPVS tools: sudo apt update && sudo apt install ipvsadm
  4. Confirm IPVS is running: sudo ipvsadm -ln
  5. Install the inlets-operator
  6. Deploy and expose nginx
  7. Note the logs for the client saying connection refused when trying to connect to the remote IP address on port 8123 on DigitalOcean, Equinix Metal or whatever cloud is being used.
2021/08/03 10:13:03 Starting TCP client. Version 0.8.8 - 57580545a321dc7549a26e8008999e12cb7161de
2021/08/03 10:13:03 Licensed to: Zespre Schmidt <[email protected]>, expires: 2 day(s)
2021/08/03 10:13:03 Upstream server: my-service, for ports: 80
Error: unable to download CA from remote inlets server for auto-tls: Get "https://165.22.103.96:8123/.well-known/ca.crt": dial tcp 165.22.103.96:8123: connect: connection refused

Note: port 8123 isn't part of the LoadBalancer service, which makes this behaviour even more questionable.

Context

A few people have run into this recently, but generally this hasn't been reported by users.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions