Skip to content

Commit

Permalink
helm: Add support for separate Postgres/Mongo listeners in teleport-c…
Browse files Browse the repository at this point in the history
…luster chart (#10858)

* helm: Update NOTES.txt for AWS ACM

* Add support for separate Postgres/MongoDB listeners in teleport-cluster chart

* Special case backend listener protocol based on presence of ACM annotation

* Don't add AWS annotations when not in AWS mode

* Adds for separatePostgresListener/separateMongoListener

Also adds missing example for setitng proxyListenerMode

* Add continuous backups permission to DynamoDB policy

Fixes #11411
  • Loading branch information
webvictim committed Mar 24, 2022
1 parent a4aa74d commit 35fc241
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 2 deletions.
77 changes: 77 additions & 0 deletions docs/pages/kubernetes-access/helm/reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,83 @@ This reference details available values for the `teleport-cluster` chart.

`proxyListenerMode` controls proxy TLS routing used by Teleport. Possible values are `multiplex`.

<Tabs>
<TabItem label="values.yaml">
```yaml
proxyListenerMode: multiplex
```
</TabItem>
<TabItem label="--set">
```code
$ --set proxyListenerMode=multiplex
```
</TabItem>
</Tabs>

## `separatePostgresListener`

| Type | Default value | Required? | `teleport.yaml` equivalent | Can be used in `custom` mode? |
| - | - | - | - | - |
| `bool` | `false` | no | `proxy_service.postgres_listen_addr` ||

`separatePostgresListener` controls whether Teleport will multiplex PostgreSQL traffic for Teleport Database Access
over a separate TLS listener to Teleport's web UI.

When `separatePostgresListener` is `false` (the default), PostgreSQL traffic will be directed to port 443 (the default Teleport web
UI port). This works in situations when Teleport is terminating its own TLS traffic, i.e. when using certificates from LetsEncrypt
or providing a certificate/private key pair via Teleport's `proxy_service.https_keypairs` config.

When `separatePostgresListener` is `true`, PostgreSQL traffic will be directed to a separate Postgres-only listener on port 5432.
This also adds the port to the `Service` that the chart creates. This is useful when terminating TLS at a load balancer
in front of Teleport, such as when using AWS ACM.

These settings will not apply if [`proxyListenerMode`](#proxylistenermode) is set to `multiplex`.

<Tabs>
<TabItem label="values.yaml">
```yaml
separatePostgresListener: true
```
</TabItem>
<TabItem label="--set">
```code
$ --set separatePostgresListener=true
```
</TabItem>
</Tabs>

## `separateMongoListener`

| Type | Default value | Required? | `teleport.yaml` equivalent | Can be used in `custom` mode? |
| - | - | - | - | - |
| `bool` | `false` | no | `proxy_service.mongo_listen_addr` ||

`separateMongoListener` controls whether Teleport will multiplex PostgreSQL traffic for Teleport Database Access
over a separate TLS listener to Teleport's web UI.

When `separateMongoListener` is `false` (the default), MongoDB traffic will be directed to port 443 (the default Teleport web
UI port). This works in situations when Teleport is terminating its own TLS traffic, i.e. when using certificates from LetsEncrypt
or providing a certificate/private key pair via Teleport's `proxy_service.https_keypairs` config.

When `separateMongoListener` is `true`, MongoDB traffic will be directed to a separate Mongo-only listener on port 27017.
This also adds the port to the `Service` that the chart creates. This is useful when terminating TLS at a load balancer
in front of Teleport, such as when using AWS ACM.

These settings will not apply if [`proxyListenerMode`](#proxylistenermode) is set to `multiplex`.

<Tabs>
<TabItem label="values.yaml">
```yaml
separateMongoListener: true
```
</TabItem>
<TabItem label="--set">
```code
$ --set separateMongoListener=true
```
</TabItem>
</Tabs>

## `enterprise`

| Type | Default value | Can be used in `custom` mode? |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
clusterName: helm-lint
separateMongoListener: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
clusterName: helm-lint
separatePostgresListener: true
5 changes: 4 additions & 1 deletion examples/chart/teleport-cluster/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ NOTE: For certificates to be provisioned, you must also install cert-manager (ht

For more information, please see the Helm guides in the Teleport docs (https://goteleport.com/docs/kubernetes-access/helm/guides/)
{{- else if (gt (int .Values.highAvailability.replicaCount) 1) }}
You have requested more than 1 replica but have not enabled cert-manager support (highAvailability.certManager.enabled=true) to get ACME certificates.
{{- if not (hasKey .Values.annotations.service "service.beta.kubernetes.io/aws-load-balancer-ssl-cert") }}
You have requested more than 1 replica but have not enabled cert-manager support (highAvailability.certManager.enabled=true) to get ACME certificates, or enabled AWS ACM
for TLS termination using the service.beta.kubernetes.io/aws-load-balancer-ssl-cert service annotation.
Your Teleport cluster will not be properly accessible by remote nodes until TLS certificates with the correct clusterName ({{ .Values.clusterName }}) are configured.

For more information, please see the Helm guides in the Teleport docs (https://goteleport.com/docs/kubernetes-access/helm/guides/)
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions examples/chart/teleport-cluster/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ data:
{{- if not .Values.proxyListenerMode }}
kube_listen_addr: 0.0.0.0:3026
mysql_listen_addr: 0.0.0.0:3036
{{- if .Values.separatePostgresListener }}
postgres_listen_addr: 0.0.0.0:5432
postgres_public_addr: {{ .Values.clusterName }}:5432
{{- end }}
{{- if .Values.separateMongoListener }}
mongo_listen_addr: 0.0.0.0:27017
mongo_public_addr: {{ .Values.clusterName }}:27017
{{- end }}
{{- end }}
enabled: true
{{- if .Values.highAvailability.certManager.enabled }}
Expand Down
15 changes: 14 additions & 1 deletion examples/chart/teleport-cluster/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $backendProtocol := ternary "ssl" "tcp" (hasKey .Values.annotations.service "service.beta.kubernetes.io/aws-load-balancer-ssl-cert") -}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -8,7 +9,7 @@ metadata:
{{- if (or (.Values.annotations.service) (eq .Values.chartMode "aws")) }}
annotations:
{{- if eq .Values.chartMode "aws" }}
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: {{ $backendProtocol }}
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-type: nlb
{{- end }}
Expand Down Expand Up @@ -43,6 +44,18 @@ spec:
port: 3036
targetPort: 3036
protocol: TCP
{{- if .Values.separatePostgresListener }}
- name: postgres
port: 5432
targetPort: 5432
protocol: TCP
{{- end }}
{{- if .Values.separateMongoListener }}
- name: mongo
port: 27017
targetPort: 27017
protocol: TCP
{{- end }}
{{- end }}
selector:
app: {{ .Release.Name }}
10 changes: 10 additions & 0 deletions examples/chart/teleport-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"type": "string",
"default": ""
},
"separatePostgresListener": {
"$id": "#/properties/separatePostgresListener",
"type": "boolean",
"default": false
},
"separateMongoListener": {
"$id": "#/properties/separateMongoListener",
"type": "boolean",
"default": false
},
"teleportVersionOverride": {
"$id": "#/properties/teleportVersionOverride",
"type": "string",
Expand Down
7 changes: 7 additions & 0 deletions examples/chart/teleport-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ authenticationType: local
# Possible values are 'multiplex'
proxyListenerMode: ""

# By default, Teleport will multiplex Postgres and MongoDB database connections on the same port as the proxy's web listener (443)
# Setting either of these values to true will separate the listeners out onto a separate port (5432 for Postgres, 27017 for MongoDB)
# This is useful when terminating TLS at a load balancer in front of Teleport (such as when using AWS ACM)
# These settings will not apply if proxyListenerMode is set to "multiplex".
separatePostgresListener: false
separateMongoListener: false

# ACME is a protocol for getting Web X.509 certificates
# Note: ACME can only be used for single-instance clusters. It is not suitable for use in HA configurations.
# Setting acme to 'true' enables the ACME protocol and will attempt to get a free TLS certificate from Let's Encrypt.
Expand Down

0 comments on commit 35fc241

Please sign in to comment.