Help › Tunnels, sign-in and passwords

Kubernetes and SSM tunnels

Connect through a kubectl port-forward or an AWS Session Manager port forward that Querlyn starts and stops for you.

Querlyn 0.1.0 is not released yet. This help describes it ahead of release.

A database inside a Kubernetes cluster, or behind an EC2 instance that has no SSH port, can be reached through the tools you already use for it. Querlyn runs kubectl port-forward or aws ssm start-session for you while the connection is open, and stops it when you disconnect.

Both routes use programs installed on your computer and your existing sign-in to the cluster or to AWS. Querlyn does not include the programs and never stores cluster or AWS credentials.

What you need

RoutePrograms
Kuberneteskubectl, signed in to the cluster
AWS SSMThe AWS CLI (aws) and its Session Manager plugin, with credentials that may start a session on the instance

Settings, under Tools, shows whether each program was found and its version, and lets you give its path. Querlyn looks for a program when a connection needs it, so you can install one without restarting Querlyn.

Connect through Kubernetes

  1. In the connection dialog, fill in Host, Port, Database and User as usual. Leave Host as the name the database's certificate is for.

  2. Under Route, choose Kubernetes.

  3. Under Forward to, choose what the tunnel points at: Pod, Service, Deployment or StatefulSet.

  4. Fill in the tunnel:

    FieldWhat to enter
    NameThe pod's, service's, deployment's or stateful set's name.
    NamespaceEmpty uses the context's namespace.
    ContextEmpty uses kubectl's current context.
    Port in the clusterThe port to forward to. Empty uses Port.
    kubeconfig fileEmpty uses kubectl's own (KUBECONFIG, or ~/.kube/config).
  5. Choose Test Route, then Test Connection.

kubectl can only forward to a port of a pod. For a database that is not a pod in the cluster, such as a managed database the cluster can reach, name a pod or service that relays to it, and the port that relay listens on. Querlyn does not create such a pod for you.

Connect through AWS Systems Manager

  1. Fill in Host, Port, Database and User as usual.

  2. Under Route, choose AWS SSM.

  3. Under Instance, enter the ID of the instance the session starts on, for example i-0123456789abcdef0.

  4. Under Forward to, choose:

    ChoiceMeaning
    Host reached from the instanceThe instance connects on to Host and Port: a database it can reach, such as an RDS endpoint.
    The instance itselfThe database listens on Port on the instance.
  5. AWS profile and Region may stay empty. Querlyn then uses the ones of the connection's AWS IAM sign-in if it has one, and otherwise the AWS CLI's defaults.

  6. Choose Test Route, then Test Connection.

Test Route and Test Connection

Test Route (Command Palette › Database: Test Route) starts the tunnel and checks that the database's port answers through it, without signing in to the database. It lists its steps, for example:

✓ Find kubectl
✓ Start kubectl port-forward to service/postgres
✓ Connect to db.internal:5432 through kubectl

Test Connection does the same and then signs in. While a test runs, the Cancel button beside Test Route, or Cancel Test beside Test Connection, stops it.

When a step fails, the message says what to do. If the fix is a command, such as signing in to AWS again, it is shown with a Copy button:

aws sso login --profile dev

Querlyn never runs a sign-in command itself.

What a tunnel means for your computer

While the connection is open, the tool listens on a port of your own computer (127.0.0.1) and passes what arrives there to the database's port. Querlyn uses it, but so can any other program running on your computer; such a program would still have to sign in to the database. The port is chosen by the tool, is never shown as the connection's address, and closes when you disconnect.

This is different from an SSH route, which opens no port. The dialog says so under the route you choose.

While you are connected

  • All tabs of the connection share one tunnel.
  • If the tool exits, for example because a pod restarted or Session Manager timed out, the sessions using it break like any dropped network. The next thing you run starts a new tunnel.
  • Disconnecting, a failed attempt, changing the route and quitting Querlyn all stop the tool.

What is not supported

  • A tunnel together with SSH hops in one connection. Point the tunnel at the pod or instance that can reach the database.
  • Other tools' tunnels, such as Teleport, Tailscale or the Cloud SQL Auth Proxy. Start those yourself and connect to the local port they open.

Help for Querlyn 0.1.0. All help topics