Rancher provisioning nodes overwrites docker images

7/17/2019

When creating a cluster with Rancher I note that Docker appears to be installing on the nodes(through rancher server ui). The problem is I am using an AMI with docker already installed with a docker image that I would like to use on the cluster after provisioning. This re-installation of docker appears to remove this docker image after provisioning.

-- Morgan Gladden
docker
kubernetes
rancher

2 Answers

7/18/2019

Assuming you are using 2.x version, there is one more way to use the AWS driver in your use case. There is a docker install URL that can be modified to any other location. You can have a simple noop script, that checks if your desired version of docker is installed, returns success else call the upstream rancher docker install script.

This way you don't have to go down the path of "Custom" cluster and take advantage of Node pool's ability to scale up and scale down at the click of a button.

-- leodotcloud
Source: StackOverflow

7/17/2019

If you're using rancher to bring k8s cluster on AWS using amazon EC2 option.

Then it will provision new EC2 in your aws account and will configure everything on it (like installing docker, k8s and so on).

To avoid this and to use your own ami which has pre-pulled docker image, you need to use custom k8s option of rancher.

In which you bring AWS EC2 machines with your own ami and then in rancher by selecting custom nodes k8s option you will have to just run a docker run command provided by rancher to configure that EC2 as either etcd, master or worker node of k8s cluster.

More info here.

Update:

To automate creation of aws ec2's make use of tools like terraform.

Here is the getting started guide, also few aws terraform examples here.

-- mchawre
Source: StackOverflow