<p>I am trying to follow the tutorial here:</p>

<p><a href="https://learn.microsoft.com/en-us/sql/linux/tutorial-sql-server-containers-kubernetes?view=sql-server-linux-2017" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/sql/linux/tutorial-sql-server-containers-kubernetes?view=sql-server-linux-2017</a></p>

<p>As directed in the tutorial, I create a kubernetes cluster and deploy a the linux sql server container.  </p>

<p>I create the secret, as in the link above, and can use **kubectl get secret ** to decrypt and verify the contents, as directed in the link here: <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/secret/</a></p>

<p>I use a persistent volume, along with a persistent volume claim, and deploy the sqldeployment.yaml, as in the link above.</p>

<p>I attach to the container using <strong>kubectl attach  -i -t</strong> and I can see the log stream. </p>

<p>When I try to log in, it says </p>

<pre><code>**SQL Management Studio:** 
Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456)

**kubectl attach output stream**
Error: 18456, Severity: 14, State: 8.
Login failed for user 'sa'. Reason: Password did not match that for the login provided.
</code></pre>

<p>I have tried all manner of passwords, including the one on the microsoft tutorial link, above.</p>

<p><strong>Question:</strong> 
- How do I set up a linux container, with the correct password, so that I can log in to the SQL Server, as directed in the Microsoft tutorial above?
- Any pointers on what I might be doing wrong?</p>

Banoona
<p>The answer is that I was using a Kubernetes persistent volume to store the database files.  I had probably stored the wrong password by initialising it once into the master database, the data for which is stored in the persistent volume. </p>

<p>Upon altering the password stored in the Kubernetes secret and redeploying the sql server service numerous times, I was confused that the password did not get reset, and I remained unable to login.  Once I had removed the persistent volume and persistent volume claim, I was able to reset the password and reinitialise it properly because the master database had been effectively reinstalled.  </p>

<p>It appears that once the password has been initialised at startup, it gets stored in the master database on the persistent volume.  Therefore, changing the Kubernetes secret - wbich stores the value of the password for the purposes of ONCE-OFF initialisation - has no effect.</p>

<p>The above scenario is easy to understand, but can be very confusing.</p>

<p>The solution was to delete the persistent volume (pv) and peristent volume claim (pvc), which effectively deleted the data files, including those of the master database, where the password is configured on the server.</p>
