# Hosts a mirror for dep pkg # kubectl apply -f dep-pkg-mirror.yaml -n [namespace] # kubectl -n [namespace] cp ./packages \ deploy/monok8s-mirror:/usr/share/nginx/html/monok8s/ # Fetch helper contract: # DEP_PKG_MIRROR=https://mirror.example.com/monok8s # mirror URL = ${DEP_PKG_MIRROR}/packages/${mirror_path} apiVersion: v1 kind: PersistentVolumeClaim metadata: name: dep-pkg-mirror-data spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi --- apiVersion: v1 kind: ConfigMap metadata: name: dep-pkg-mirror-nginx data: default.conf: | server { listen 8080; server_name _; root /usr/share/nginx/html; autoindex on; autoindex_exact_size off; autoindex_localtime on; location /monok8s/packages/ { try_files $uri =404; } location = /healthz { access_log off; return 200 "ok\n"; } } --- apiVersion: apps/v1 kind: Deployment metadata: name: dep-pkg-mirror spec: replicas: 1 selector: matchLabels: app: dep-pkg-mirror template: metadata: labels: app: dep-pkg-mirror spec: containers: - name: nginx image: nginx:1.27-alpine imagePullPolicy: IfNotPresent ports: - name: http containerPort: 8080 readinessProbe: httpGet: path: /healthz port: http livenessProbe: httpGet: path: /healthz port: http volumeMounts: - name: data mountPath: /usr/share/nginx/html/monok8s/packages subPath: packages readOnly: false - name: nginx-conf mountPath: /etc/nginx/conf.d/default.conf subPath: default.conf readOnly: true volumes: - name: data persistentVolumeClaim: claimName: dep-pkg-mirror-data - name: nginx-conf configMap: name: dep-pkg-mirror-nginx --- apiVersion: v1 kind: Service metadata: name: dep-pkg-mirror spec: type: ClusterIP selector: app: dep-pkg-mirror ports: - name: http port: 80 targetPort: http