I'm pretty new to Kubernetes, so i have deployed the castlemock application in a Kubernetes pod using helm 3.
Here are the helm objects.
values.yml (not the whole content):
replicaCount: 1
image:
repository: castlemock/castlemock
tag: 1.39
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: traefik
hosts:
- host: chart-example.local
paths:
- /castlemock
deployment.yml (not the whole content):
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
And then I do the port forward: kubectl port-forward svc/castlemock 3000:8080
From the people behind castlemock, the application can be access behind the path /castlemock.
But when I try localhost:3000 I see the tomcat homepage, when I try localhost:3000/castlemock I have a 404.
Did I messed up something or how should the Kubernetes objets be set to access applications running by tomcat?
I made it works by following the steps listed in this castlemock tutorial on dev.to
Follow this guide to deploy a war file on tomcat running on kubernetes. You should be able to access it via the service itself and don't necessarily need ingress. Once you are able to access it via service then introduce ingress as an extra layer if needed.
Check this question as well.