0

I've been studying "Kubernetes Up and Running" by Hightower et al (first edition) Chapter 13 where they discussed creating a Reliable MySQL Singleton (Since I just discovered that there is a second edition, I guess I'll be buying it soon).

Using their MySQL reliable singleton example as a model, I've been looking for some sample YAML files to make a similar deployment with Microsoft SQL Server (Express) on Docker Desktop for Kubernetes.

Apparently I need YAML files to deploy

  1. Persistent Volume
  2. Volume claim (should this be NFS?)
  3. SQL Server (Express edition) replica set (in spite of the fact that this is just a singleton).

I've tried this example but I'm confused because it does not contain a persistent volume & claim and it does not work. I get the error

Error: unable to recognize "sqlserver.yml": no matches for kind "Deployment" in version "apps/v1beta1"

Can someone please point me to some sample YAML files that are not Azure specific that will work on Docker Desktop Kubernetes for Windows 10? After debugging my application, I'll want to deploy this to Azure (AKS).

Wed Jul 15 2020 Update

I left out the "-n namespace" for the helm install command (possibly because I'm using Helm and you are using helm v2?).

That install command still did not work. Then I did a

helm repo add stable https://kubernetes-charts.storage.googleapis.com/

Now this command works:

helm install todo-app-database stable/mssql-linux

Progress!

When I do a "k get pods" I see that my todo-app-mssql-linux database is in the pending state. So I did a

kubectl get events

and I see

Warning   FailedScheduling   pod/todo-app-database-mssql-linux-8668d9b88c-lsh5l   0/1 nodes are available: 1 Insufficient memory.

I've been google searching for "Kubernetes insufficient memory" and can find no match.

I suspect this is a problem specific to "Docker Desktop Kubernetes".

When I look at the output for

helm -n ns-todolistdemo template todo-app-database stable/mssql-linux

I see the deployment is asking for 2Gi. (Interesting: when I use the template command, the "-n ns-todolistdemo" does not cause an error like it does with the install command).

So I do

kubectl describe deployment todo-app-database-mssql-linux >todo-app-database-mssql-linux.yaml

I edit the yaml file to change 2Gi to 1Gi.

kubectl apply -f todo-app-database-mssql-linux.yaml

I get this error:

error: error parsing todo-app-database-mssql-linux.yaml: error converting YAML to JSON: yaml: line 9: mapping values are not allowed in this context

Hmm... that did not work. I try delete:

kubectl delete deployment todo-app-database-mssql-linux
kubectl create -f todo-app-database-mssql-linux.yaml

I get this error:

error: error validating "todo-app-database-mssql-linux.yaml": error validating data: invalid object to validate; if you choose to ignore these errors, turn validation off with --validate=false

So I try apply:

kubectl apply -f todo-app-database-mssql-linux.yaml

Same error!

Shucks.... Is there a way to adjust the memory allocation for Docker Desktop?

Thank you

Siegfried

1 Answer 1

1

Short answer

https://github.com/helm/charts/blob/master/stable/mssql-linux/templates/pvc-master.yaml

Detailed Answer

Docker For Desktop comes already with a default StorageClass : #

This storage class is responsible for auto-provisioning of PV whenever you create a PVC.

If you have a YAML definition of PVC (persistent volume claim), you just need to keep storageClass empty, so it will use the default.

k get storageclass
NAME                 PROVISIONER                                       AGE
hostpath (default)   docker.io/hostpath                                11d

This is fair enough as Docker-For-Desktop Cluster is a one node cluster. So if your DB crashes and the cluster opens it again , it will not move to another node, because simply, you have a single node :)

Now should write the YAML of PVC from scratch ?

No , you don't need. Because Helm should be your best friend.

( I explained below Why you have to use Helm even without deep learning curve)

Fortunately, the community provides a chart called stable/mssql-linux.. Let's run it together :

helm -n <your-namespace> install todo-app-database stable/mssql-linux
# helm -n <namespace> install <release-name> <chart-name-from-community>

If you want to check the YAML (namely PVC) that Helm computed, you can run template instead of install

helm -n <your-namespace> template todo-app-database stable/mssql-linux

Why I give you the answer with Helm ?

Writing YAML from scratch lets reinventing the wheel while others do it.

The most efficient way is to reuse what community prepare for you.

However, you may ask: How can i reuse what others doing ?

That's why Helm comes.

Helm comes to be your installer of any application on top of kubernetes regardless how much YAML does your app require.

Install it now and hit the ground choco install kubernetes-helm

Sign up to request clarification or add additional context in comments.

1 Comment

I have downloaded & unzipped helm and added it to my path. Since I'm having trouble with specifying a namespace, I'm google searching some tutorials now on this subject now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.