I want to setup local auto deployment from Jenkins container to Kubernetes cluster, runned by Docker Desktop.
In most tutorials the recommended way is to use ssh to Kubernetes master-node to be able to issue cubectl commands. So is there any way to do this in Docker Desktop? As far as I know minikube has minikube ssh for that.
According to Stackoverflow’s advices:
Use docker run -it --rm --privileged --pid=host justincormack/nsenter1 to break out into the host namespaces.
But its unclear what do I need to do further to issue cubectl commands against master-node.
There is no need to ssh into anything, the kubectl command comes with Docker Desktop:
If you type this command into a Powershell termial:
(gcm kubectl).Path
You will see the path to the binary. Though, you don’t have to use the full path. Just kubectl should be enough.
You can use kubectl config current-context to check if the context is set to docker-desktop.
If not, you can switch to the context with kubectl config use-context docker-desktop.
You can list all context with kubectl config get-contexts