0

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.

Dale K
  • 25,246
  • 15
  • 42
  • 71

3 Answers3

1

the easiest way of doing that is using something like:

kubectl get deployment -n %yournamespace% -o yaml > export.yaml
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
0

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.

Jakub
  • 8,189
  • 1
  • 17
  • 31
0

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
  • 3,820
  • 1
  • 23
  • 41