Skip to content

Fix Kubernetes Legacy Proxy heartbeats#29733

Merged
tigrato merged 2 commits intomasterfrom
tigrato/fix-legacy-proxy-heartbeat
Jul 28, 2023
Merged

Fix Kubernetes Legacy Proxy heartbeats#29733
tigrato merged 2 commits intomasterfrom
tigrato/fix-legacy-proxy-heartbeat

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Jul 28, 2023

When a Teleport Kubernetes Proxy runs in legacy mode - i.e. - spec enables proxy_service.kubernetes.enabled, the proxy is capable of proxy requests to a target Kubernetes cluster instead of forwarding them to a Teleport Kubernetes Service.

The following config enables the legacy proxy mode in proxy:

proxy_service:
    enabled: yes
    web_listen_addr: 0.0.0.0:3080
    public_addr: tele.local:3080
    kubernetes:
      enabled: yes
      listen_addr: 0.0.0.0:3026
      kubeconfig_file: path # optional

Because the proxy forwards and heartbeat the configured Kube clusters, it needs permissions to upsert the kube cluster in auth's backend and to extend its expiration date.

This PR fixes a problem introduced in Teleport 8 where the proxy is allowed to upsert the kube server, but it's not allowed to extend the expiration time.

When the request fails, the proxy becomes degraded and the performance is affected.

When a Teleport Kubernetes Proxy runs in legacy mode - i.e. - spec
enables `proxy_service.kubernetes.enabled`, the proxy is capable of
proxy requests to a target Kubernetes cluster instead of forwarding them
to a Teleport Kubernetes Service.

The following config enables the legacy proxy mode in proxy:

```yaml
proxy_service:
    enabled: yes
    web_listen_addr: 0.0.0.0:3080
    public_addr: tele.local:3080
    kubernetes:
      enabled: yes
      listen_addr: 0.0.0.0:3026
      kubeconfig_file: path # optional
```

Because the proxy forwards and heartbeat the configured Kube clusters,
it needs permissions to upsert the kube cluster in auth's backend and
to extend its expiration date.

This PR fixes a problem that exists since Teleport 8 where the proxy
is allowed to upsert the kube server but it's not allowed to extend the
expiration time.

When the request fails, the proxy becomes in degraded state and the
performance is affected.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Copy link
Copy Markdown
Contributor

@rosstimothy rosstimothy left a comment

Choose a reason for hiding this comment

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

Can we add a test to cover this scenario?

@tigrato tigrato force-pushed the tigrato/fix-legacy-proxy-heartbeat branch from 6078eb3 to c038457 Compare July 28, 2023 15:20
Copy link
Copy Markdown
Contributor

@espadolini espadolini left a comment

Choose a reason for hiding this comment

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

This PR fixes a problem introduced in Teleport 8

approved based on this

@tigrato
Copy link
Copy Markdown
Contributor Author

tigrato commented Jul 28, 2023

Can we add a test to cover this scenario?

098648c

@tigrato tigrato requested a review from rosstimothy July 28, 2023 15:48
Copy link
Copy Markdown
Contributor

@rosstimothy rosstimothy left a comment

Choose a reason for hiding this comment

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

Thanks for the test!

@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from gabrielcorado July 28, 2023 15:49
@tigrato tigrato enabled auto-merge July 28, 2023 15:49
@tigrato tigrato added this pull request to the merge queue Jul 28, 2023
Merged via the queue into master with commit 25b0623 Jul 28, 2023
@tigrato tigrato deleted the tigrato/fix-legacy-proxy-heartbeat branch July 28, 2023 16:22
@public-teleport-github-review-bot
Copy link
Copy Markdown

@tigrato See the table below for backport results.

Branch Result
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants