Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{# pre-pull images into each node with "pulling concurrency control" #}
{% set image = "your_repo/your_image:your_tag" %}
{% set docker_registry_credential = "your-cred" %}
{% set node_key = "type" %}
{% set node_value = "cpu" %}
{% set n_nodes = 1 %}
{# this concurrency number can be gradually changed afterwards, by using, e.g., k edit your_replicaset #}
kind: ReplicaSet
apiVersion: extensions/v1beta1
metadata:
name: pre-pull-image
spec:
replicas: {{ n_nodes }}
template:
metadata:
labels:
hasOnePodOnNode: yy
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: {{ node_key }}
operator: In
values:
- {{ node_value }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: hasOnePodOnNode
operator: In
values:
- yy
topologyKey: "kubernetes.io/hostname"
{% if docker_registry_credential != "" %}
imagePullSecrets:
- name: {{ docker_registry_credential }}
{% endif %}
containers:
- name: tmp-pre-pull-image
image: {{ image }}
imagePullPolicy: IfNotPresent
command:
- "sleep"
args:
- "36000000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.