Skip to main content

Connecting

Connecting to a database created by the MSSQL Provider is the same as connecting to any instance managed by the MSSQL Operator — the provider creates the underlying operator resource and its Services.

Services​

TopologyService to useNotes
Standalone<name> (headless) or <name>-exposedUse <name>-exposed when a serviceType other than ClusterIP is set.
Availability Group<name>-primary (read-write)Follows failover to the current primary.
Availability Group<name>-replicas (read-only)Routes to readable secondaries.

Retrieve the SA password​

The provider creates a Secret for the instance's SA password. Retrieve it with:

kubectl get secret <secret-name> -o jsonpath='{.data.MSSQL_SA_PASSWORD}' | base64 -d

Connect​

For port-forwarding, sqlcmd examples, LoadBalancer/NodePort access, and TLS certificate trust, follow the operator's Connecting guide — everything there applies to provider-managed instances.

kubectl port-forward svc/<name>-primary 1433:1433
sqlcmd -S "tcp:localhost,1433" -U sa -P "$SA_PASSWORD" -C -Q "SELECT @@VERSION"