diff --git a/docs/configuration/tls.md b/docs/configuration/tls.md index 492db227..1a4ec916 100644 --- a/docs/configuration/tls.md +++ b/docs/configuration/tls.md @@ -4,120 +4,154 @@ TLS can be configured via the `tls.secretName` and `tls.clientAuth` parameters o When TLS is enabled for the external inferencing interface, all of the ModelMesh Serving internal (intra-Pod) communication will be secured using the same certificates. The internal links will use mutual TLS regardless of whether client authentication is required for the external connections. -There are various ways to generate TLS certificates, below are steps on how to do this using OpenSSL or CertManager. +There are various ways to generate TLS certificates. Below are steps on how to do this using OpenSSL or CertManager. ## Generating TLS Certificates for Dev/Test using OpenSSL -To create a SAN key/cert for TLS, use command: +First, define the variables that will be used in the commands below. Change the values to suit your environment: ```shell -openssl req -x509 -newkey rsa:4096 -sha256 -days 3560 -nodes -keyout example.key -out example.crt -subj '/CN=modelmesh-serving' -extensions san -config openssl-san.config +NAMESPACE="modelmesh-serving" # the controller namespace where ModelMesh Serving was deployed +SECRET_NAME="modelmesh-certificate" ``` -Where the contents of `openssl-san.config` look like: +Create an OpenSSL configuration file named `openssl-san.config`: -``` +```shell +cat > openssl-san.config << EOF [ req ] distinguished_name = req [ san ] subjectAltName = DNS:modelmesh-serving.${NAMESPACE},DNS:localhost,IP:0.0.0.0 +EOF +``` + +Use the following command to create a SAN key/cert: + +```shell +openssl req -x509 -newkey rsa:4096 -sha256 -days 3560 -nodes \ + -keyout server.key \ + -out server.crt \ + -subj "/CN=${NAMESPACE}" \ + -extensions san \ + -config openssl-san.config ``` -With the generated key/cert, create a kube secret with contents like: +From there, you can create a secret using the generated certificate and key: -```yaml +```shell +kubectl apply -f - < - tls.key: - ca.crt: + tls.crt: $(cat server.crt) + tls.key: $(cat server.key) + ca.crt: $(cat server.crt) +EOF ``` -For basic TLS, only the fields `tls.crt` and `tls.key` are needed in the kube secret. For mutual TLS, add `ca.crt` in the kube secret and set the configuration `tls.clientAuth` to `require` in the ConfigMap `model-serving-config`. - -## Creating TLS Certificates using CertManager +**Note:** For basic TLS, only the fields `tls.crt` and `tls.key` are required. For mutual TLS, `ca.crt` should be included and `tls.clientAuth` should be set to `require` in the [`model-serving-config` ConfigMap](./README.md). -1. If necessary, install `cert-manager` in the cluster - follow the steps here: https://cert-manager.io/docs/installation/. +Alternatively, you can create this secret imperatively using: -2. Create an `Issuer` CR - - kubectl apply -f - < ca.crt + ```shell + kubectl get secret ${SECRET_NAME} -o jsonpath="{.data.ca\.crt}" > ca.crt + ```