sql-serverkubernetesconfigkubernetes-statefulset

Configuring SQL Server in Kubernetes StatefulSet with Custom TLS Settings: Bootstraping in a Container using a Custom Configuration File


I'm currently deploying SQL Server in a Kubernetes StatefulSet and facing challenges in providing a custom configuration file (mssql-config.conf) during the startup process. I want to ensure that SQL Server uses specific configurations from my custom file.

Current Issue:

Example Configuration for TLS:

[network]
tlscert = /etc/ssl/certs/mssql.pem
tlskey = /etc/ssl/private/mssql.key
tlsprotocols = 1.2
forceencryption = 1

I appreciate any insights, examples, or recommendations from the community to address this challenge.


Solution

  • Based on the comments, I created and mounted the certificate and configuration files before starting SQL Server:

    First, I mounted the required certificate and key files at a path like /var/opt/mssql/tls/ using Kubernetes Secrets.

    Then I passed an initialization script in the SQL Server container to create the mssql.conf file at /var/opt/mssql/ with the desired certificates and configurations. After that, I started SQL Server, which then used the configurations provided in the /var/opt/mssql/mssql.conf file.

    This ensures that SQL Server starts with the custom TLS settings/custom configuration specified in the configuration file.