How to get the deployment.yaml file for MSSQL cluster in Kubernetes

9/30/2019

I am installing the SQL Server cluster in Kubernetes setup using the below document.

Check here.

I am able to install the cluster successfully. But I need to customize the deployment by specifying the custom docker image, add additional containers.

May I know how to get the deployment YAML file & Dockerfile for all the images in the running containers?

I have tried "kubectl edit", but not able to edit required details.

-- Gogula Raja Selvakumar Radhika
azure
azure-devops
docker
kubernetes
sql-server

3 Answers

9/30/2019

Kubernetes Cheat Sheet is a good source for kubectl commands.

Let's say your deployments are created in develop namespace. Below command will help you to get a yaml out of your deployment, --export flag will remove the cluster specific information.

kubectl get deploy <your-deployment-name> --namespace=develop -o yaml --export > your-deployment.yaml

Below command will help you to get a json out of your deployment.

kubectl get deploy <your-deployment-name> --namespace=develop -o json --export > your-deployment.yaml
-- MangeshBiradar
Source: StackOverflow

9/30/2019

For Kubernetes YAML files you can use:

kubectl get <pod,svc,all,etc> <name> --export=true -o yaml 

or

kubectl get <pod,svc,all,etc> <name> -o yaml

For Docker Dockerfiles there is whole post on stackoverflow which explain how to create a dockerfile from an image.

-- jt97
Source: StackOverflow

9/30/2019

the easiest way of doing that is using something like:

kubectl get deployment -n %yournamespace% -o yaml > export.yaml
-- 4c74356b41
Source: StackOverflow