From 162d17311b69fdc99454d8178a4d2d47e1f2a263 Mon Sep 17 00:00:00 2001 From: Alen Haric Date: Wed, 3 Apr 2024 13:56:24 -0400 Subject: [PATCH 1/3] updated automatic cert-manager rotation docs to walk users through process of using cert-manager for entire trust chain Signed-off-by: Alen Haric --- ...-rotating-control-plane-tls-credentials.md | 248 ++++++++++--- ...ically-rotating-webhook-tls-credentials.md | 333 +++++++++--------- 2 files changed, 356 insertions(+), 225 deletions(-) diff --git a/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md b/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md index 3c332585e5..fa8b52dc4c 100644 --- a/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md +++ b/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md @@ -6,14 +6,15 @@ aliases = [ "use_external_certs" ] Linkerd's [automatic mTLS](../../features/automatic-mtls/) feature generates TLS certificates for proxies and automatically rotates them without user -intervention. These certificates are derived from a *trust anchor*, which is -shared across clusters, and an *issuer certificate*, which is specific to the +intervention. These certificates are derived from a _trust anchor_, which is +shared across clusters, and an _issuer certificate_, which is specific to the cluster. While Linkerd automatically rotates the per-proxy TLS certificates, it does not -rotate the issuer certificate. In this doc, we'll describe how to set up -automatic rotation of the issuer certificate and its corresponding private key -using the cert-manager project. +rotate the issuer certificate. Linkerd's out-of-the-box installations generate +static self-signed certificates with a validity of one year but require manual +rotation by the user to prevent expiry. While this setup is convenient for quick +start testing, it's not advisable nor recommended for production environments. {{< trylpt >}} @@ -24,17 +25,23 @@ for making TLS credentials from external sources available to Kubernetes clusters. Cert-manager is very flexible. You can configure it to pull certificates from -secrets managemenet solutions such as [Vault](https://www.vaultproject.io). In +secrets managemenet solutions such as [Vault](https://www.vaultproject.io). In this guide, we'll focus on a self-sufficient setup: we will configure cert-manager to act as an on-cluster [CA](https://en.wikipedia.org/wiki/Certificate_authority) and have it re-issue Linkerd's issuer certificate and private key on a periodic basis, derived from -the trust anchor. +the trust anchor. Additionally, we will use trust-manager create a trust bundle +which will allow Linkerd to verify the authenticity of certificates issued by +cert-manager. ### Cert manager as an on-cluster CA -As a first step, [install cert-manager on your -cluster](https://cert-manager.io/docs/installation/). +As a first step, +[install cert-manager on your cluster](https://cert-manager.io/docs/installation/), +then +[install trust-manager](https://cert-manager.io/docs/trust/trust-manager/installation/) +and configure it to use "linkerd" as the +[trust namespace](https://cert-manager.io/docs/trust/trust-manager/installation/#trust-namespace). Next, create the namespace that cert-manager will use to store its Linkerd-related resources. For simplicity, we suggest reusing the default @@ -44,46 +51,111 @@ Linkerd control plane namespace: kubectl create namespace linkerd ``` -#### Save the signing key pair as a Secret +#### Give cert-manager necessary RBAC permissions -Next, using the [`step`](https://smallstep.com/cli/) tool, create a signing key -pair and store it in a Kubernetes Secret in the namespace created above: +By default cert-manager will only create certificate secrets in the namespace +where it is installed. Linkerd, however, requires the cert secrets to be created +in the linkerd namespace. To do this we will create a `ServiceAccount` for +cert-manager in the linkerd namespace with the required permissions. ```bash -step certificate create root.linkerd.cluster.local ca.crt ca.key \ - --profile root-ca --no-password --insecure && - kubectl create secret tls \ - linkerd-trust-anchor \ - --cert=ca.crt \ - --key=ca.key \ - --namespace=linkerd +kubectl apply -f - <}} -When installing the `linkerd-control-plane` chart, you _must_ provide the -issuer trust root and issuer credentials as described in [Installing Linkerd -with Helm](../install-helm/). -{{< /note >}} +{{< note >}} When installing the `linkerd-control-plane` chart, you _must_ +provide the issuer trust root and issuer credentials as described in +[Installing Linkerd with Helm](../install-helm/). {{< /note >}} -See [Automatically Rotating Control Plane TLS -Credentials](../automatically-rotating-control-plane-tls-credentials/) +See +[Automatically Rotating Control Plane TLS Credentials](../automatically-rotating-control-plane-tls-credentials/) for details on how to do something similar for control plane credentials. From 4d37a1d652e92042d2aa25117ac540096582321c Mon Sep 17 00:00:00 2001 From: Alen Haric Date: Wed, 3 Apr 2024 13:58:26 -0400 Subject: [PATCH 2/3] fixed style recommendations Signed-off-by: Alen Haric --- .../automatically-rotating-control-plane-tls-credentials.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md b/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md index fa8b52dc4c..7ce1dbade5 100644 --- a/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md +++ b/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md @@ -6,8 +6,8 @@ aliases = [ "use_external_certs" ] Linkerd's [automatic mTLS](../../features/automatic-mtls/) feature generates TLS certificates for proxies and automatically rotates them without user -intervention. These certificates are derived from a _trust anchor_, which is -shared across clusters, and an _issuer certificate_, which is specific to the +intervention. These certificates are derived from a **trust anchor**, which is +shared across clusters, and an **issuer certificate**, which is specific to the cluster. While Linkerd automatically rotates the per-proxy TLS certificates, it does not From c0f7d3cea9a2d538613534af01de8af95cc446a5 Mon Sep 17 00:00:00 2001 From: Alen Haric Date: Wed, 3 Apr 2024 14:09:50 -0400 Subject: [PATCH 3/3] fixing linter style conflicts Signed-off-by: Alen Haric --- .../automatically-rotating-control-plane-tls-credentials.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md b/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md index 7ce1dbade5..4ba7f7d662 100644 --- a/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md +++ b/linkerd.io/content/2.15/tasks/automatically-rotating-control-plane-tls-credentials.md @@ -6,8 +6,8 @@ aliases = [ "use_external_certs" ] Linkerd's [automatic mTLS](../../features/automatic-mtls/) feature generates TLS certificates for proxies and automatically rotates them without user -intervention. These certificates are derived from a **trust anchor**, which is -shared across clusters, and an **issuer certificate**, which is specific to the +intervention. These certificates are derived from a *trust anchor*, which is +shared across clusters, and an *issuer certificate*, which is specific to the cluster. While Linkerd automatically rotates the per-proxy TLS certificates, it does not