问题
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?
回答1:
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:
- Minikube.sigs.k8s.io: Docs: Commands: Start
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
来源:https://stackoverflow.com/questions/64758012/location-of-kubernetes-config-directory-with-docker-desktop-on-windows