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

How to deploy Indy image to Kubernetes #82

Open
tadayosi opened this issue Jun 13, 2022 · 3 comments
Open

How to deploy Indy image to Kubernetes #82

tadayosi opened this issue Jun 13, 2022 · 3 comments

Comments

@tadayosi
Copy link

Hi,

After #80, now I want to deploy Indy to a K8s cluster so that it can be used as an alternative to Nexus Repo Manager. I've come up with my own primitive settings (see below) but I'd like to know your recommended settings with optionally more advanced features, such as externalised etc and data volumes.

Could you please add some documentation and/or examples on how to deploy Indy to K8s/OpenShift?

Thank you!

apiVersion: apps/v1
kind: Deployment
metadata:
  name: indy
  namespace: indy
spec:
  selector:
    matchLabels:
      app: indy
  template:
    metadata:
      labels:
        app: indy
    spec:
      containers:
        - name: indy
          image: quay.io/factory2/indy:2.7.2
          ports:
            - name: 8080-tcp
              containerPort: 8080
            - name: 8081-tcp
              containerPort: 8081
          livenessProbe:
            httpGet:
              path: /api/stats/version-info
              port: 8080
            initialDelaySeconds: 30 
            periodSeconds: 3
          readinessProbe:
            httpGet:
              path: /api/stats/version-info
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 3
          volumeMounts:
            - name: indy-etc
              mountPath: /opt/indy/etc/indy
      initContainers:
        - name: init-etc
          image: busybox
          command: ["sh", "-c"]
          args:
            - cd /tmp && wget -O etc.tar.gz https://github.com/Commonjava/indy/releases/download/indy-parent-2.7.2/indy-launcher-2.7.2-etc.tar.gz && tar -xf etc.tar.gz && mv etc/* /opt/indy/etc/indy/
          volumeMounts:
            - name: indy-etc
              mountPath: /opt/indy/etc/indy
      volumes:
        - name: indy-etc
          emptyDir: {}
@ligangty
Copy link
Member

ligangty commented Jun 13, 2022

Hello @tadayosi I have two proposals:

  1. Makes the indy configuration as configmap instead of a sidecar. You can create two configmaps for it: main.conf and logback.xml. I've merged a new pr with a merged main.conf in one file which can make it easily managed as configmap, please see new code.
  2. If you want to persist all artifacts for your environment, please create a pvc to store all them. You can mount this pvc at /opt/indy/var/lib/indy (this can be conigured through "storage.dir" under [storage-default] section in main.conf).

@tadayosi
Copy link
Author

tadayosi commented Jun 13, 2022

Thanks @ligangty! Actually initially I tried the configmap approach (see my setup below) but somehow it didn't succeed to deploy. The contents of the configmaps were created from https://github.com/Commonjava/indy/releases/download/indy-parent-2.7.2/indy-launcher-2.7.2-etc.tar.gz.

For the item 2, thans for your suggestion.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: indy
  namespace: indy
spec:
  selector:
    matchLabels:
      app: indy
  template:
    metadata:
      labels:
        app: indy
    spec:
      containers:
        - name: indy
          image: quay.io/factory2/indy:2.7.2
          ports:
            - name: 8080-tcp
              containerPort: 8080
            - name: 8081-tcp
              containerPort: 8081
          livenessProbe:
            httpGet:
              path: /api/stats/version-info
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 3
          readinessProbe:
            httpGet:
              path: /api/stats/version-info
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 3
          volumeMounts:
            - name: indy-etc
              mountPath: /opt/indy/etc/indy/main.conf
              subPath: main.conf
            - name: indy-etc-confd
              mountPath: /opt/indy/etc/indy/conf.d
            - name: indy-etc-keycloak
              mountPath: /opt/indy/etc/indy/keycloak
            - name: indy-etc-logging
              mountPath: /opt/indy/etc/indy/logging
      volumes:
        - name: indy-etc
          configMap:
            name: indy-etc
        - name: indy-etc-confd
          configMap:
            name: indy-etc-confd
        - name: indy-etc-keycloak
          configMap:
            name: indy-etc-keycloak
        - name: indy-etc-logging
          configMap:
            name: indy-etc-logging

@ligangty
Copy link
Member

ligangty commented Dec 6, 2022

@tadayosi Sorry for late reply. For the configmap stuff, do you have any error logs for tracking?

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

2 participants