Last active
November 18, 2018 11:37
-
-
Save Tim-Schwalbe/e66089a48b8e89efb8453c38c6caf114 to your computer and use it in GitHub Desktop.
Cache Images in K8S
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1beta2 | |
kind: DaemonSet | |
metadata: | |
name: prepull-image | |
spec: | |
selector: | |
matchLabels: | |
name: prepull-image | |
template: | |
metadata: | |
labels: | |
name: prepull-image | |
spec: | |
initContainers: | |
- name: prepull | |
image: eu.gcr.io/YOUR_IMAGE:latest | |
command: ["/bin/sh"] | |
args: ["-c", "ls"] | |
containers: | |
- name: pause | |
image: gcr.io/google_containers/pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cache Image: | |
variables: | |
DOCKER_DRIVER: overlay2 | |
DOCKER_HOST: tcp://localhost:2375 | |
image: dtzar/helm-kubectl:2.10.0 | |
stage: Cache Image | |
before_script: | |
- apk update && apk add curl docker sed | |
- echo $KUBE_CONFIG | base64 -d > ./kube_config | |
- export KUBECONFIG=$PWD/kube_config | |
script: | |
- kubectl delete daemonset prepull-image -n YOUR_NAMESPACE | |
- kubectl apply -f cache_docker_images_in_cluster.yaml -n YOUR_NAMESPACE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment