Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lab 12 — ConfigMaps & Persistent Volumes
What was done:
threading.Lock()to prevent race conditions; counter reads/writes toVISITS_FILEenv var path (default/data/visits) with graceful fallback to 0 on missing or corrupted fileGET /visitsendpoint returning current count and timestamp; updatedGET /to includevisitsfield and new endpoint in the endpoints listmonitoring/docker-compose.ymlto use bind mount./data:/datainstead of named volume — named volumes are owned by root on creation, causingPermissionErrorsince container runs as non-rootappuser; confirmed persistence acrossdocker compose restart(counter continued from 3 → 4)k8s/devops-python/files/config.jsonwith app name, environment, feature flags, and settings; addedtemplates/configmap.yamlwith two ConfigMaps — file ConfigMap using.Files.Getmounted at/config/config.json, and env ConfigMap with 4 keys injected viaenvFrom.configMapRef; verified both inside podk8s/devops-python/templates/pvc.yamlwith 100Mi ReadWriteOnce claim using default storage class; mounted at/datain deployment; confirmed PVC persistence — visits counter preserved at 4 afterkubectl delete podBonus:
kubectl editand observingenvironment: stagingappear in mounted file after 60ssubPathare copied once at pod creation and never auto-update because they bypass the symlink mechanism used for directory mountschecksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}triggers rolling pod restart whenever ConfigMap content changes viahelm upgrade, ensuring pods always reload with fresh configuration