Created
September 25, 2024 22:09
-
-
Save cemtopkaya/607c0bc8edc65ce252f9c5de405290cb to your computer and use it in GitHub Desktop.
tmpfs İle init container desenine göre dosya paylaşımı
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
version: "3.8" | |
volumes: | |
cache_vol: | |
driver_opts: | |
type: tmpfs | |
device: tmpfs | |
services: | |
init-container: | |
image: busybox | |
entrypoint: ["sh", "-c", "echo 'some data' > /config_1/shared-file"] | |
volumes: | |
- cache_vol:/config_1 | |
main-container: | |
image: busybox | |
entrypoint: ["sh", "-c", "cat /config_1/shared-file"] | |
volumes: | |
- cache_vol:/config_1 | |
depends_on: | |
- init-container |
Kubernetes içinde koşabilen hali:
apiVersion: v1
kind: Pod
metadata:
name: tmpfs-pod
spec:
containers:
- name: init-container
image: busybox
command: ["sh", "-c", "echo 'some data' > /config_1/shared-file && sleep 60"]
volumeMounts:
- name: cache-vol
mountPath: /config_1
- name: main-container
image: busybox
command: ["sh", "-c", "cat /config_1/shared-file"]
volumeMounts:
- name: cache-vol
mountPath: /config_1
volumes:
- name: cache-vol
emptyDir:
medium: Memory # emptyDir ile tmpfs kullanarak RAM üzerinde dosya saklanır
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Eğer

entrypoint: ["sh", "-c", "echo 'some data' > /config_1/shared-file && echo 'done'"]
satırıyla init-container başlatılırsa ekran çıktısı şöyle olur ve anlarız ki init bitmiş main başlamış ve bitmiş.