# Kubernetes not able to set Collation in sqldeployment.yaml

**URL:** <https://discuss.kubernetes.io/t/kubernetes-not-able-to-set-collation-in-sqldeployment-yaml/16892>\
**Category:** General Discussions\
**Created:** [July 29, 2021, 5:14am UTC](https://discuss.kubernetes.io/t/kubernetes-not-able-to-set-collation-in-sqldeployment-yaml/16892 "2021-07-29T05:14:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nedelcho\_Sitnov](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nedelcho_sitnov/32/8248_2.png) [@Nedelcho\_Sitnov](https://discuss.kubernetes.io/u/Nedelcho_Sitnov)\
**Post date:** [July 29, 2021, 5:14am UTC](https://discuss.kubernetes.io/t/kubernetes-not-able-to-set-collation-in-sqldeployment-yaml/16892/1 "2021-07-29T05:14:12Z")

</div>

Hello,  
I deployed ms sql server with Kubernetes, but in sqldeployment.yaml there is no place where I can change the default Collation???

The Collation bellow does not work.  
Any help???

image: microsoft/mssql-server-linux:2017-latest  
env:

- name: MSSQL\_PID  
value: Express
- name: ACCEPT\_EULA  
value: “Y”
- name: MSSQL\_COLLATION  
value: “Cyrillic\_General\_CI\_AS”
- name: SA\_PASSWORD

### Cluster information:

Kubernetes version:  
Cloud being used: (put bare-metal if not on a public cloud)  
Installation method:  
Host OS:  
CNI and version:  
CRI and version:

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

---

<div class="post-metadata">

**Author:** ![protosam](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/protosam/32/7732_2.png) [@protosam](https://discuss.kubernetes.io/u/protosam)\
**Post date:** [July 29, 2021, 6:23am UTC](https://discuss.kubernetes.io/t/kubernetes-not-able-to-set-collation-in-sqldeployment-yaml/16892/2 "2021-07-29T06:23:41Z")

</div>

Is `MSSQL_COLLATION` a valid variable for the container image? I don’t see [any mention of at the container registry](https://hub.docker.com/_/microsoft-mssql-server).

As far as I can tell, you need an `initContainer` that:

- mounts the dataset
- runs as root

It will need to run a script that does something like this:

- checks if collation needs to be updated
- if it does, run `/opt/mssql/bin/mssql-conf set-collation COLLATION_NAME` against the data

---

<div class="post-metadata">

**Author:** ![Nedelcho\_Sitnov](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nedelcho_sitnov/32/8248_2.png) [@Nedelcho\_Sitnov](https://discuss.kubernetes.io/u/Nedelcho_Sitnov)\
**Post date:** [July 29, 2021, 1:55pm UTC](https://discuss.kubernetes.io/t/kubernetes-not-able-to-set-collation-in-sqldeployment-yaml/16892/3 "2021-07-29T13:55:34Z")

</div>

I did it as root, but it does not change the collation

## ------SSH root------------ kubectl exec -it mssql-deployment-6b5db58dd7-z8gtm bash

./kubectl-wls

---

<div class="post-metadata">

**Author:** ![protosam](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/protosam/32/7732_2.png) [@protosam](https://discuss.kubernetes.io/u/protosam)\
**Post date:** [July 29, 2021, 5:05pm UTC](https://discuss.kubernetes.io/t/kubernetes-not-able-to-set-collation-in-sqldeployment-yaml/16892/4 "2021-07-29T17:05:13Z")

</div>

The official documentation doesn’t mention it, but if you search Google for “change mssql collation linux” you should stumble upon sites like [this](https://www.mssqltips.com/sqlservertip/4763/how-to-change-sql-server-collation-on-linux/) that explain the first step to do is to stop the service. This is why I think it needs to happen in an initContainer.

The official documentation for this tool can be found [here](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-mssql-conf?view=sql-server-2017#collation).

The complete documentation for mssql on Linux is here:

> **[Overview of SQL Server on Linux - SQL Server](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-overview?view=sql-server-ver15)**
>
> This article describes how SQL Server runs on Linux and provides information on how to learn more.

---

<div class="post-metadata">

**Author:** ![Nedelcho\_Sitnov](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/nedelcho_sitnov/32/8248_2.png) [@Nedelcho\_Sitnov](https://discuss.kubernetes.io/u/Nedelcho_Sitnov)\
**Post date:** [July 30, 2021, 5:03am UTC](https://discuss.kubernetes.io/t/kubernetes-not-able-to-set-collation-in-sqldeployment-yaml/16892/5 "2021-07-30T05:03:52Z")

</div>

I did it.  
It can be done during initialization of the Cluster.  
In sqldeployment.yaml you have to include Collation.  
containers:  
- name: mssql  
image: microsoft/mssql-server-linux:2017-latest  
env:  
- name: MSSQL\_PID  
value: Express  
- name: ACCEPT\_EULA  
value: “Y”  
- name: MSSQL\_COLLATION  
value: “Cyrillic\_General\_CI\_AS”  
- name: SA\_PASSWORD  
valueFrom:  
secretKeyRef:  
name: mssql  
key: password  
ports:  
- name: mssql  
containerPort: 1433
