简体   繁体   English

如何获取部署。Kubernetes 中 MSSQL 集群的 yaml 文件

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

I am installing the SQL Server cluster in Kubernetes setup using the below document.我正在使用以下文档在 Kubernetes 设置中安装 SQL 服务器集群。

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.但我需要通过指定自定义 docker 映像来自定义部署,添加额外的容器。

May I know how to get the deployment YAML file & Dockerfile for all the images in the running containers?我可以知道如何为正在运行的容器中的所有图像获取部署 YAML 文件和 Dockerfile 吗?

I have tried "kubectl edit", but not able to edit required details.我尝试过“kubectl edit”,但无法编辑所需的详细信息。

the easiest way of doing that is using something like:最简单的方法是使用类似的东西:

kubectl get deployment -n %yournamespace% -o yaml > export.yaml

For Kubernetes YAML files you can use:对于 Kubernetes YAML 文件,您可以使用:

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.对于 Docker Dockerfiles ,stackoverflow 上有整篇文章解释了如何从图像创建 dockerfile。

Kubernetes Cheat Sheet is a good source for kubectl commands. Kubernetes Cheat Sheetkubectl命令的良好来源。

Let's say your deployments are created in develop namespace.假设您的部署是在develop命名空间中创建的。 Below command will help you to get a yaml out of your deployment, --export flag will remove the cluster specific information.下面的命令将帮助您从部署中获取yaml ,-- --export标志将删除集群特定信息。

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.以下命令将帮助您从部署中获取json

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM