Specifying the Kubernetes version in Docker Desktop for Mac - docker

It looks like Docker Desktop for Mac is using a 1.22+ version of Kubernetes which introduces a number of breaking changes specifically to the ingress-nginx controller apiVersion. This is causing issues with our local development cluster.
There are couple options:
Rolling back the Kubernetes version to something <1.22 in the development cluster.
Updating ingress-nginx and the development configuration to use >=1.22.
I'm trying to go with route 1. and downgrade the version to match our production cluster: v1.20.7 primarily because 1.22+ isn't available in Azure yet it looks like. It makes sense to me to have the development and production versions match.
That is my question: How do you change the version of Kuberentes that `docker-desktop uses?
If that can't be done, then I guess I'll just have to go with 2.
What've tried so far is simply following the kubectl documentation:
curl -LO "https://dl.k8s.io/release/v1.20.7/bin/darwin/arm64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version --client
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.0", GitCommit:"ab69524f795c42094a6630298ff53f3c3ebab7f4", GitTreeState:"clean", BuildDate:"2021-12-07T18:08:39Z", GoVersion:"go1.17.3", Compiler:"gc", Platform:"darwin/arm64"}
Skeptical it was going to work and sure enough it doesn't.
Edit:
Option 3.: use something like minikube, mikrok8s, k3d, etc.
It is looking like the only way to downgrade change the kubectl version is to downgrade Docker Desktop for Mac.

As best as I could determine, there is not a way to do this. (Please correct me if I'm wrong).
The options appear to just be:
Downgrade Docker Desktop for Mac to a version that has the version of Kubernetes that you want. Can find previous versions here: https://docs.docker.com/desktop/mac/release-notes/
Use something like minikube, mikrok8s, k3d, etc. that gives you better control over the Kubernetes version being used.
I ended up just dong 1. as opposed to adding another tool to our development environment, but 2. feels like a much better option.

Related

Which kubectl should I use on macOS?

On macOS there's Docker Desktop which comes with a kubectl, there's the Homebrew kubectl, then there's the gcloud kubectl.
I'm looking to use Minikube for local Kubernetes development and also GKE for production.
Which kubectl should I use? I'm thoroughly confused by all the various versions and how they differ from one another. Does it matter at all other than the version of the binary?
It doesn't really matter from where you get an executable as long as it is a trusted source. Although you have to use a supported version (documentation):
kubectl is supported within one minor version (older or newer) of kube-apiserver.
Example:
kube-apiserver is at 1.20
kubectl is supported at 1.21, 1.20, and 1.19

Prevent Kops from replacing docker installation when provisioning nodes

I use custom images (AMIs) configured for machine learning on GPU-enabled EC2 instances.
This means cuda, libcudnn6, nvidia-docker etc are all properly setup on them.
However when Kops starts new nodes from these AMIs (I use cluster-autoscaler) it overrides my properly setup docker.
How can I prevent that?
For now I run a custom script on startup that re-installs nvidia-docker properly, but that's obviously not ideal.
Kops will only install docker if there's a difference between the version it expects to use and the version that is already installed on the node.
Note that Kops will downgrade docker if the installed version is higher than what it expects!
So the solution to my problem was to have a pre-installed version that matches spec.docker.version.
For this we had to downgrade docker to 17.03.2 and nvidia-docker to 2.0.3+docker17.03.2-1.

Can I Install Docker Over cPanel?

Can I install Docker over a server with pre-installed cPanel and CentOS 7? Since I am not aware of Docker, I am not completely sure whether it will mess with cPanel or not. I already have a server with CentOS 7 and cPanel configured. I want to know if I can install Docker over this configuration I mentioned without messing up?
Yes you can install docker over cPanel/WHM just like installing it on any other CentOS server/virtual machine.
Just follow these simple steps (as root):
1) yum install -y yum-utils device-mapper-persistent-data lvm2 (these should be already installed...)
2) yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3) yum install docker-ce
4) enable docker at boot (systemctl enable docker)
5) start docker service (systemctl start docker)
The guide above is for CentOS 7.x. Don't expect to find any references or options related to Docker in the WHM interface. You will be able to control docker via command line from a SSH shell.
I have some docker containers already running on my cPanel/WHM server and I have no issues with them. I basically use them for caching, proxying and other similar stuff.
And as long as you follow these instructions, you won't mess-up any of your cPanel/WHM services/settings or current cPanel accounts/settings/sites/emails etc.
Not sure why you haven't tried this already!
I've been doing research and working on getting Docker working on cPanel. It's not just getting it to work on a CentOS 7 box but rather making it palatable for the cPanel crowd in the form of a plugin. So far I can confirm that it's absolutely doable. Here's what I've accomplished and how:
Integrate Docker Compose with cPanel (which is somewhat a step
further from WHM)
Leverage the user-namespace kernel feature in Linux so Docker
services can't escalate their privileges (see userns remap)
Leverage Docker Compose so users can build complex services and
start ready apps from the store with a click
Make sure services starting via Docker run on a non-public IP on the
server. Everything gets routed via ProxyPass
cPanel has been gracious to provide a Slack channel for people to discuss this upcoming plugin. I'd be more than happy to invite you if you'd like to be kept updated or to contribute. Let me know!
FYI, there's more info here on https://www.unixy.net/docker if you're interested. Please note that this plugin is in private beta but more than happy to let people use it!
Yes you could, in fact someone else has done it already: https://github.com/mirhosting/cPanel-docker

client is newer than server (client API version: 1.24, server API version: 1.21)

When I do :
sudo docker version
I obtain this error:
Error response from daemon:client is newer than server (client API version: 1.24, server API version: 1.21)
Anyone can help me to understand what I have to do?
Try setting the version using the command:
export DOCKER_API_VERSION=1.23
It worked perfectly fine for me and resolved the issue.
Docker is running on client / server model, each Docker Engine release has a specific API version.
The combination of the release version and API version of Docker is as follows:
https://docs.docker.com/engine/api/v1.26/#section/Versioning
According to the table above, the Docker API v1.24 is used in Docker Engine 1.12.x and the Docker API v1.21 is used in the Docker Engine 1.9.x. The server needs API version equal to or later than the client.
You have the following three options.
Upgrade the server side to Docker Engine 1.12.x or later.
Downgrade the client side to Engine 1.9.x or lower.
Downgrade the API version used at run time by exporting the DOCKER_API_VERSION=1.21 to environment variable on the client side.
The other answers don't really explain how to do this on a windows machine. I had no access to the gui so I had to get it done from the CLI.
I know this is old, but I fumbled with this for a while until I finally figured it out. So, I hope this helps someone.
Windows Users
For people who are on windows you can set your env variables by going to the Advanced System Settings.
If you need to do it via command line. This is what worked for me:
setx /M DOCKER_API_VERSION "1.23"
Additionally, you can also set the permanent host location, and then just run your commands without the -H option by using the following:
setx /M DOCKER_HOST "192.168.207.131:2375"
NOTE: after you set the variables you must close the command line and open a new one for the changes to take affect.
NOTE 2: If changes are being made to a remote system, you need to logout and log back in for the changes to take affect.

Install Ambari based on docker on multiple hosts

I have three servers and I want to set up Ambari. Unfortunately I have CentOS7 which currently isn't supported by Ambari. So I decided to use docker to overcome the OS dependency. I have found various docker-based Ambari version like this and this. The second one seems to be really good and easy to install on one host creating a pseudo-cluster, but I failed to install it on different hosts. I followed the described steps one by one trying to adjust them to the fact that I am not one the same host but when I try to assign a new host I get an error that the hostname is not valid.
For the first solution on the other hand, I can't understand the following. How can I make the containers on each host be aware of each other? Because Ambari needs every host to can ssh each other without password.
Excuse me in advance for my lack of expertise in this domain. Any comment would be very useful.
Ambari 2.2+ can be installed successfully and works fine on CentOS 7. Then you can install HDP 2.0+.
The links in your question try to install 1.6 and 1.7.

Resources