Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

$ helm uninstall [Release Name] -n [Namespace]
$ kubectl delete ns [Namespace]

Guide for Dockerfile & k8s manifests

Info
iconfalse
titleDockerfile

FROM openjdk:11-jre-slim

RUN groupadd appgroup && useradd -G appgroup appuser
WORKDIR /app
RUN chown appuser:appgroup /app
USER appuser

ENV TZ=Asia/Seoul
EXPOSE 8080

COPY target/*.jar /app/app.jar

COPY pinpoint/pinpoint-agent-2.2.2.tar.gz /app/pinpoint-agent-2.2.2.tar.gz
RUN mkdir /app/pinpoint-agent \
    && tar -xf /app/pinpoint-agent-2.2.2.tar.gz --strip 1 -C /app/pinpoint-agent \
    && rm /app/pinpoint-agent-2.2.2.tar.gz \
    && chmod 777 /app/pinpoint-agent/logs
COPY pinpoint/pinpoint.config /app/pinpoint-agent/pinpoint.config

COPY shell/invoke.sh /app/invoke.sh

ENTRYPOINT /bin/bash /app/invoke.sh

Info
iconfalse
titleConfigmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: pinpoint-config
data:

  APPLICATION_NAME: micro-app
  JAVA_OPTS: "-server -Xmx2g -Xms2g -Dspring.profiles.active=prod"
  PINPOINT_OPTS: "-javaagent:/app/pinpoint-agent/pinpoint-bootstrap-2.2.2.jar -Dpinpoint.config=/app/pinpoint-agent/pinpoint.config"

Info
iconfalse
titleDeployment.yaml

apiVersion : apps/v1
kind: Deployment
metadata:
  name: micro-app
spec:
      containers:
        - name: micro-app
          image: {ContainerRegistry}/apps/micro-app
          env:
            - name: MY_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name

          envFrom:
          - configMapRef:
              name: pinpoint-config

Info
iconfalse
titleinvoke.sh

#!/bin/bash
if [[ -n "${PINPOINT_OPTS}" ]]; then
  exec java ${JAVA_OPTS} ${PINPOINT_OPTS} -Dpinpoint.applicationName=${APPLICATION_NAME} -Dpinpoint.agentId="${APPLICATION_NAME}-${MY_POD_NAME:(-5)}" -jar /app/app.jar
else
  exec java ${JAVA_OPTS} -jar /app/app.jar