Rancher Kubernetes in an offline infratstructure

Hi all,

I would like to know how to deploy a kubernetes environment in an offline infrastructure. How to do this for Cattle is described here: http://docs.rancher.com/rancher/v1.2/en/installing-rancher/installing-server/no-internet-access/ and we have applied this solution with success.

We want to experiment with k8s but the adding host fase gets stuck in creating the system stack (due to not being able to pull the required containers from dockerhub).

Is there a way to let Rancher agent pull the required containers for a k8s cluster from a private registry? I would seem logical that a same approach (start Rancher server with ENV var’s) can be applied for k8s and Swarm.

Note: Pre-pulling the rancher/k8s and other images to the hosts is not a solution due to the fact that we only use a private registry and therefore the images have the registry prefixed.

Thanks!

I working on it almost a week for now with semi success…
Fastest way is to pre-pull all necessary images to the host and retag them.
For example:
docker pull localregistry.local:5000/rancher/k8s:v1.2.4-rancher10
and then
docker tag localregistry.local:5000/rancher/k8s:v1.2.4-rancher10 rancher/k8s:v1.2.4-rancher10
Don’t forget to pre-pull pause:2.0 image necessary for kubernetes functionality
Another way is to mirror rancher-catalog git repo to you local git repo and change image tags in docker-compose.yaml ini infra-templates/kubernetes and add --pod-infra-container-image=localregisty.local:5000/kubernetes/pause:2.0 to kubelet args.
Run server with -e DEFAULT_CATTLE_CATALOG_URL=‘library=http://localgit.local/rancher-catalog.git’

I might have a solution:

Yep i’am already fingered it out. I git cloned rancher-catalog and changed all tags in infra-templates to local ones.
Here is my settings for rancher/server:

docker run -d --restart=unless-stopped
-e DEFAULT_CATTLE_CATALOG_URL=‘library=http://local-git.local/rancher-catalog.git’
-e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=local.registry.local:5000/rancher/agent:v1.1.0
-e CATTLE_LB_INSTANCE_IMAGE=local.registry.local:5000/rancher/lb-service-haproxy:v0.4.2
-p 8080:8080
–name rancher-server local.registry.local:5000/rancher/server:v1.2.0

Dont’t forget to add --pod-infra-container-image=localregisty.local:5000/kubernetes/pause:3.0 to kubelet args in infra-templates/k8s.

Everything works like a charm 8)

1 Like

Awesome! Thanks! :slight_smile: