Allow pre-downloaded images to be used effectively

According to http://kubernetes.io/docs/user-guide/images/ :
By default, the kubelet will try to pull each image from the
specified registry. However, if the imagePullPolicy property
of the container is set to IfNotPresent or Never, then a local\
image is used (preferentially or exclusively, respectively).

Use IfNotPresent value to allow images prepared by the download
role dependencies to be effectively used by kubelet without pull
errors resulting apps to stay blocked in PullBackOff/Error state
even when there are images on the localhost exist.

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
pull/642/head
Bogdan Dobrelya 2016-11-22 16:16:04 +01:00
parent dc58159d16
commit dff78f616e
11 changed files with 16 additions and 0 deletions

View File

@ -139,6 +139,9 @@ dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address')
## to self hosted registries like so: ## to self hosted registries like so:
docker_options: "--insecure-registry={{ kube_service_addresses }}" docker_options: "--insecure-registry={{ kube_service_addresses }}"
# K8s image pull policy (imagePullPolicy)
k8s_image_pull_policy: IfNotPresent
# default packages to install within the cluster # default packages to install within the cluster
kpm_packages: [] kpm_packages: []
# - name: kube-system/grafana # - name: kube-system/grafana

View File

@ -15,6 +15,7 @@ spec:
containers: containers:
- name: dnsmasq - name: dnsmasq
image: "{{ dnsmasq_image_repo }}:{{ dnsmasq_image_tag }}" image: "{{ dnsmasq_image_repo }}:{{ dnsmasq_image_tag }}"
imagePullPolicy: {{ k8s_image_pull_policy }}
command: command:
- dnsmasq - dnsmasq
args: args:

View File

@ -24,6 +24,7 @@ spec:
containers: containers:
- name: calico-policy-controller - name: calico-policy-controller
image: {{ calico_policy_image_repo }}:{{ calico_policy_image_tag }} image: {{ calico_policy_image_repo }}:{{ calico_policy_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
env: env:
- name: ETCD_ENDPOINTS - name: ETCD_ENDPOINTS
value: "{{ etcd_access_endpoint }}" value: "{{ etcd_access_endpoint }}"

View File

@ -22,6 +22,7 @@ spec:
containers: containers:
- name: kubedns - name: kubedns
image: "{{ kubedns_image_repo }}:{{ kubedns_image_tag }}" image: "{{ kubedns_image_repo }}:{{ kubedns_image_tag }}"
imagePullPolicy: {{ k8s_image_pull_policy }}
resources: resources:
# TODO: Set memory limits when we've profiled the container for large # TODO: Set memory limits when we've profiled the container for large
# clusters, then set request = limit to keep this container in # clusters, then set request = limit to keep this container in
@ -64,6 +65,7 @@ spec:
protocol: TCP protocol: TCP
- name: dnsmasq - name: dnsmasq
image: "{{ kubednsmasq_image_repo }}:{{ kubednsmasq_image_tag }}" image: "{{ kubednsmasq_image_repo }}:{{ kubednsmasq_image_tag }}"
imagePullPolicy: {{ k8s_image_pull_policy }}
args: args:
- --log-facility=- - --log-facility=-
- --cache-size=1000 - --cache-size=1000
@ -78,6 +80,7 @@ spec:
protocol: TCP protocol: TCP
- name: healthz - name: healthz
image: "{{ exechealthz_image_repo }}:{{ exechealthz_image_tag }}" image: "{{ exechealthz_image_repo }}:{{ exechealthz_image_tag }}"
imagePullPolicy: {{ k8s_image_pull_policy }}
resources: resources:
# keep request = limit to keep this container in guaranteed class # keep request = limit to keep this container in guaranteed class
limits: limits:

View File

@ -10,6 +10,7 @@ spec:
containers: containers:
- name: kube-apiserver - name: kube-apiserver
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
command: command:
- /hyperkube - /hyperkube
- apiserver - apiserver

View File

@ -10,6 +10,7 @@ spec:
containers: containers:
- name: kube-controller-manager - name: kube-controller-manager
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
command: command:
- /hyperkube - /hyperkube
- controller-manager - controller-manager

View File

@ -10,6 +10,7 @@ spec:
containers: containers:
- name: kube-scheduler - name: kube-scheduler
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
command: command:
- /hyperkube - /hyperkube
- scheduler - scheduler

View File

@ -10,6 +10,7 @@ spec:
containers: containers:
- name: kube-proxy - name: kube-proxy
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
command: command:
- /hyperkube - /hyperkube
- proxy - proxy

View File

@ -10,6 +10,7 @@ spec:
containers: containers:
- name: nginx-proxy - name: nginx-proxy
image: {{ nginx_image_repo }}:{{ nginx_image_tag }} image: {{ nginx_image_repo }}:{{ nginx_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
securityContext: securityContext:
privileged: true privileged: true
volumeMounts: volumeMounts:

View File

@ -48,6 +48,7 @@ spec:
# container hosts. # container hosts.
- name: flannel - name: flannel
image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}" image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}"
imagePullPolicy: {{ k8s_image_pull_policy }}
env: env:
# Cluster name # Cluster name
- name: CLUSTER_NAME - name: CLUSTER_NAME
@ -117,6 +118,7 @@ spec:
# host. # host.
- name: calico-node - name: calico-node
image: "{{ calico_node_image_repo }}:{{ calico_node_image_tag }}" image: "{{ calico_node_image_repo }}:{{ calico_node_image_tag }}"
imagePullPolicy: {{ k8s_image_pull_policy }}
env: env:
# The location of the etcd cluster. # The location of the etcd cluster.
- name: ETCD_ENDPOINTS - name: ETCD_ENDPOINTS

View File

@ -18,6 +18,7 @@
containers: containers:
- name: "flannel-container" - name: "flannel-container"
image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}" image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}"
imagePullPolicy: {{ k8s_image_pull_policy }}
command: command:
- "/bin/sh" - "/bin/sh"
- "-c" - "-c"