Skip to content

pndv/sql-server-kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unblock/Open the port

This is very important, especially on Windows. You must create a rule on Windows firewall to listen on TCP port 1433 (or the port where you have decided for SQL Server).

Kubernetes Secrets and a BIG GOTCHA!

For creating secret as opaque string, the password (or secret string) should be encoded as Base64 value. This can be done via many online tools. If you are on *nix systems, you can also use following command:

echo -n secret-to-encode | base64

The switch -n prevents adding appending any newline to the encoded value; this can prevent hours of debugging wherein you think you are providing the correct password but still failing to login!

Similarly, decoding on *nix is as simple as:

base64 --decode encoded-string

I am not aware of any PowerShell command as simple as this.

For further details, see MiniKube Readme

Additional helpful commands

Get secret

Print only pod name (useful for plugging in the name of pod in another command)

kubectl get pods -o custom-columns=:metadata.name --no-headers=true

Alias to shorten the command on *nix

alias kno='kubectl get pods -o custom-columns=:metadata.name --no-headers=true'

Alias on PowerShell

function kno() { kubectl get pods -o custom-columns=:metadata.name --no-headers=true }

A list of PowerShell aliases can be seen in this GitHub File

Running SQL commands

Checking login

kubectl exec <<pod-name>> -- /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P <your_password>

Running query

kubectl exec <<pod-name>> -- /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P <your_password> -Q "<query>"

About

Deployments of MS SQL Server on Kubernetes via minikube, Helm etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published