$ oc new-project mssql$ oc create secret generic mssql --from-literal=SA_PASSWORD="Sql2019isfast"$ oc apply -f https://raw.githubusercontent.com/erfinfeluzy/ocp4-notes/master/assets/mssql-storage.yaml$ oc apply -f https://raw.githubusercontent.com/erfinfeluzy/ocp4-notes/master/assets/mssql-deployment.yamlnote:
- deployment uses image from microsoft mcr.microsoft.com/mssql/server:2017-CU8-ubuntu
- expose service as loadbalancer
Remote shell to mssql pods
$ oc get pods
$ oc rsh mssql-deployment-XXXXXXXquery inside pods
$ cd /opt/mssql-tools/bin
$ ./sqlcmd -S localhost -U sa -P Sql2019isfast
1> create database dbtest
2> select name from sys.databases
3> go
name
------------------------------
master
tempdb
model
msdb
dbtest
(5 rows affected)
1> use dbtest
2> create table tphone(id int, name nvarchar(50))
3> insert into tphone values(100,'Aina')
4> go
Changed database context to 'dbtest'.
(1 rows affected)
1> select * from tphone
2> go
id name
----------- --------------------------------------------------
100 Aina
(1 rows affected)
1> quit$ oc apply -f https://raw.githubusercontent.com/erfinfeluzy/ocp4-notes/master/assets/dotnet-template-erfin.json$ oc get pods
$ oc rsh mssql-deployment-XXXXXXXQuery inside mssql pods
$ cd /opt/mssql-tools/bin
$ ./sqlcmd -S localhost -U sa -P Sql2019isfast
1> use myContacts
2> go
Changed database context to 'myContacts'.
1> select * from Customers
2> go
Id Name
----------- ----------------------------------------------------------------------------------------------------
1 erfin2
2 aryo
(2 rows affected)Add label to mssql deployment
app.kubernetes.io/name=mssqlAdd label to dotnet deployment
app.kubernetes.io/name=dotnet
