Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s container initialization design #43

Open
oxess opened this issue Dec 14, 2021 · 0 comments
Open

K8s container initialization design #43

oxess opened this issue Dec 14, 2021 · 0 comments

Comments

@oxess
Copy link

oxess commented Dec 14, 2021

Hi!
This configuration under k8s takes to long time run.
Maybe use a initial container pattern?

Pod config will have a initial container with download tar and unpacking.
This will better for health checking by k8s.

This require small changes in entrypoint and copy logic to init.sh

Example deployment config:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nominatim
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nominatim
  template:
    metadata:
      labels:
        app: nominatim
    spec:
      initContainers:
      - name: nominatim
        image: peterevans/nominatim-k8s:latest
        command: ["init.sh"]
        volumeMounts:
          - name: pg-data
            mountPath: /var/lib/postgresql/9.5/main
      containers:
      - name: nominatim
        image: peterevans/nominatim-k8s:latest
        resources:
          limits:
            memory: "500Mi"
            cpu: "0.2"
          requests:
            memory: "150Mi"
            cpu: "0.06"
        ports:
        - containerPort: 8080
          name: web
        livenessProbe:
          httpGet:
            path: /status.php
            port: web
          failureThreshold: 1
          periodSeconds: 10
        startupProbe:
          httpGet:
            path: /status.php
            port: web
          failureThreshold: 30
          periodSeconds: 10
          initialDelaySeconds: 250
        volumeMounts:
        - name: firebase-credentials-volume
          mountPath: /etc/credentials
          readOnly: true
        - name: pg-data
          mountPath: /var/lib/postgresql/9.5/main
        envFrom:
        - configMapRef:
            name: nominatim-envs-config
      volumes:
      - name: firebase-credentials-volume
        secret:
          secretName: firebase-credentials-secret
      - name: pg-data
        emptyDir: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant