Hi, I’ve encountered an issue with a Spring Boot application where the log files, generated upon startup, stored under the logs folder of it starts, are visible when using kubectl run
, but not when deploying through a YAML file. Below are the Dockerfile and deployment.yaml for reference:
Dockerfile
FROM openjdk:11
WORKDIR /home/web
# RUN echo "Asia/Shanghai" > /etc/timezone
ENV TZ=Asia/Shanghai
COPY addon.jar /home/web
CMD ["java","-jar","/home/web/addon.jar"]
Oddly, when running k run test --image docker.io/lkfan1/addon-demo:v10
, I can observe the logs folder using the exec command. However, the logs folder is not visible when deploying using the following deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: jira-addon
labels:
app: jira-addon
tier: backend
spec:
replicas: 3
selector:
matchLabels:
app: jira-addon
tier: backend
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: jira-addon
tier: backend
spec:
containers:
- name: jira-addons
image: docker.io/lkfan1/addon-demo:v10
imagePullPolicy: Always
ports:
- name: https
containerPort: 8443
- name: http
containerPort: 8080
securityContext:
runAsNonRoot: true
runAsUser: 1001
volumeMounts:
- mountPath: /home/
name: addon-data
volumes:
- name: addon-data
persistentVolumeClaim:
claimName: addon-data-pvc