Last active
October 23, 2020 11:57
-
-
Save liptanbiswas/00071abfe583e51fe1425ff1979b025f to your computer and use it in GitHub Desktop.
Gitlab Docker Layer Caching for Kubernetes Executor
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
## PVC for storing dind data | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
labels: | |
app: docker-dind | |
name: docker-dind-data | |
namespace: gitlab-managed-apps | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 100Gi |
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
## Service for exposing docker-dind | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
app: docker-dind | |
name: docker-dind | |
namespace: gitlab-managed-apps | |
spec: | |
ports: | |
- port: 2375 | |
protocol: TCP | |
targetPort: 2375 | |
selector: | |
app: docker-dind |
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
## Deployment for docker-dind | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: docker-dind | |
name: docker-dind | |
namespace: gitlab-managed-apps | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: docker-dind | |
template: | |
metadata: | |
labels: | |
app: docker-dind | |
spec: | |
containers: | |
- image: docker:19.03-dind | |
name: docker-dind | |
env: | |
- name: DOCKER_HOST | |
value: tcp://0.0.0.0:2375 | |
- name: DOCKER_TLS_CERTDIR #Disable TLS as traffic is not going outside of network. | |
value: "" | |
volumeMounts: | |
- name: docker-dind-data-vol #Persisting the docker data | |
mountPath: /var/lib/docker/ | |
ports: | |
- name: daemon-port | |
containerPort: 2375 | |
protocol: TCP | |
securityContext: | |
privileged: true #Required for dind container to work. | |
volumes: | |
- name: docker-dind-data-vol | |
persistentVolumeClaim: | |
claimName: docker-dind-data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment