Windows 上 Docker 桌面的 Kubernetes 配置目录的位置 [英] Location of Kubernetes config directory with Docker Desktop on Windows
问题描述
我正在通过 Windows 上的 Docker 桌面运行本地 Kubernetes 集群.我正在尝试修改我的 kube-apiserver 配置,我发现的所有信息都说要修改主服务器上的 /etc/kubernetes/manifests/kube-apiserver.yaml
.我一直无法找到此文件,并且不确定执行此操作的正确方法是什么.是不是因为集群是通过Docker Desktop的,所以流程不一样?
是否有不同的过程,因为集群是通过 Docker Desktop 的?
您可以使用在 Docker 桌面上运行但在hacky"中的 Kubernetes 访问 kubeapi-server.yaml
大大地.我已经在下面提供了解释.
对于需要此类重新配置的设置,我鼓励您使用不同的解决方案,例如 minikube
.
Minikube
有一项功能,允许您为 Kubernetes 组件传递附加选项.您可以按照以下文档阅读有关 --extra-config ExtraOption
的更多信息:
关于kube-apiserver.yaml
与Docker Desktop的重新配置
您需要运行以下命令:
$ docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
以上命令将允许您运行 $ vi/etc/kubernetes/manifests/kube-apiserver.yaml
并编辑 api 服务器的配置.运行 kubeapi-server
的 Pod
将使用新参数重新启动.
您可以查看以下 StackOverflow 答案以获取更多参考:
- Stackoverflow.com:答案:Docker Desktop for Windows kubelet 日志位于何处?
- Stackoverflow.com:答案:如何更改 Mac (docker-desktop) 上的默认节点端口范围?<块引用>
我在没有
$ screen
命令的情况下使用了这个答案,我能够在 Windows 的 Docker 桌面上重新配置kubeapi-server
I am running a local Kubernetes cluster through Docker Desktop on Windows. I'm attempting to modify my kube-apiserver config, and all of the information I've found has said to modify /etc/kubernetes/manifests/kube-apiserver.yaml
on the master. I haven't been able to find this file, and am not sure what the proper way is to do this. Is there a different process because the cluster is through Docker Desktop?
Is there a different process because the cluster is through Docker Desktop?
You can get access to the kubeapi-server.yaml
with a Kubernetes that is running on Docker Desktop but in a "hacky" way. I've included the explanation below.
For setups that require such reconfigurations, I encourage you to use different solution like for example minikube
.
Minikube
has a feature that allows you to pass the additional options for the Kubernetes components. You can read more about --extra-config ExtraOption
by following this documentation:
As for the reconfiguration of kube-apiserver.yaml
with Docker Desktop
You need to run following command:
$ docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
Above command will allow you to run $ vi /etc/kubernetes/manifests/kube-apiserver.yaml
and edit the configuration of the api server. The Pod
running kubeapi-server
will be restarted with new parameters.
You can check below StackOverflow answers for more reference:
- Stackoverflow.com: Answer: Where are the Docker Desktop for Windows kubelet logs located?
- Stackoverflow.com: Answer: How to change the default nodeport range on Mac (docker-desktop)?
I've used this answer without
$ screen
command and I was able to reconfigurekubeapi-server
on Docker Desktop in Windows
这篇关于Windows 上 Docker 桌面的 Kubernetes 配置目录的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!