Hi, I am getting following exception when trying t...
# help
c
Hi, I am getting following exception when trying to bring Kubernetes deployment of wiremock to enable https. I am using wiremock/wiremock:3.11.0 docker image. Exception in thread "main" Exception: java.util.MissingResourceException thrown from the UncaughtExceptionHandler in thread "main" My wiremock deployment contains this environmental variable:
Copy code
env {
  name  = "WIREMOCK_OPTIONS"
  value = "--https-port=8443 --https-keystore=/home/wiremock/keystore.p12 --keystore-password=$(env:KEYSTORE_PASSWORD)"
}
And Dockerfile is:
Copy code
FROM wiremock/wiremock:3.11.0

# Ensure /home/wiremock/ directory exists
RUN mkdir -p /home/wiremock/

# Set /home/wiremock/ as the working directory
WORKDIR /home/wiremock/

# Let the environment variable WIREMOCK_OPTIONS handle the configuration
CMD []
I got this reference on the internet https://github.com/wiremock/wiremock/issues/2374 but still getting the exception with wiremock k8 pod in CrashLoopBackOff status.
l
Is the full stack trace available?
c
No, I just have this much trace available only. However if this pod describe helps: kubectl describe pod wiremock-deployment-7df659fcc4-smj9s -n aps-wiremock-k8-deployment Name: wiremock-deployment-7df659fcc4-smj9s Namespace: aps-wiremock-k8-deployment Priority: 0 Service Account: default Node: ip-10-191-154-60.ec2.internal/10.191.154.60 Start Time: Mon, 17 Feb 2025 172610 +0530 Labels: app.kubernetes.io/name=wiremock-deployment app.kubernetes.io/version=k8-deployment inception.tivo.com/env=mock inception.tivo.com/owner=yellowstone inception.tivo.com/product=wiremock-server inception.tivo.com/team=yellowstone pod-template-hash=7df659fcc4 Annotations: inception.tivo.com/email: chandra.singh@xperi.com inception.tivo.com/slack: kubernetes.io/limit-ranger: LimitRanger plugin set: ephemeral-storage request for container wiremock-deployment; ephemeral-storage limit for container wiremock-deploy... Status: Running IP: 10.191.154.41 IPs: IP: 10.191.154.41 Controlled By: ReplicaSet/wiremock-deployment-7df659fcc4 Containers: wiremock-deployment: Container ID: containerd://d124d0c260bff69d13124ac82485128d9c6b49b9fb49a046073398eac480cb9f Image: docker.tivo.com/csingh/wiremock:3.2 Image ID: docker.tivo.com/csingh/wiremock@sha256:f2f90ef002e933290daf772568486fd060cc1835ce5fa53f73b00d1d51c083ed Port: 8443/TCP Host Port: 0/TCP Args: --https-port=8443 --https-keystore=/home/wiremock/keystore.p12 --keystore-password=$(env:KEYSTORE_PASSWORD) --keystore-type=PKCS12 State: Waiting Reason: CrashLoopBackOff Last State: Terminated Reason: Error Exit Code: 1 Started: Mon, 17 Feb 2025 172653 +0530 Finished: Mon, 17 Feb 2025 172653 +0530 Ready: False Restart Count: 3 Limits: cpu: 2 ephemeral-storage: 512Mi memory: 2Gi Requests: cpu: 500m ephemeral-storage: 512Mi memory: 512Mi Environment: WIREMOCK_OPTIONS: --https-port=8443 --https-keystore=/home/wiremock/keystore.p12 --keystore-password=$(env:KEYSTORE_PASSWORD) --keystore-type=PKCS12 ENABLE_HTTPS: true KEYSTORE_PASSWORD: <set to the key 'keystore-password' in secret 'wiremock-tls-secret'> Optional: false Mounts: /home/wiremock from wiremock-certs (ro) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-mvgwc (ro) Conditions: Type Status PodReadyToStartContainers True Initialized True Ready False ContainersReady False PodScheduled True Volumes: wiremock-certs: Type: Secret (a volume populated by a Secret) SecretName: wiremock-tls-secret Optional: false kube-api-access-mvgwc: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: <nil> DownwardAPI: true QoS Class: Burstable Node-Selectors: <none> Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 70s default-scheduler Successfully assigned aps-wiremock-k8-deployment/wiremock-deployment-7df659fcc4-smj9s to ip-10-191-154-60.ec2.internal Normal Pulling 70s kubelet Pulling image "docker.tivo.com/csingh/wiremock:3.2" Normal Pulled 68s kubelet Successfully pulled image "docker.tivo.com/csingh/wiremock:3.2" in 1.637s (1.637s including waiting). Image size: 109544065 bytes. Normal Created 27s (x4 over 68s) kubelet Created container wiremock-deployment Normal Started 27s (x4 over 68s) kubelet Started container wiremock-deployment Normal Pulled 27s (x3 over 67s) kubelet Container image "docker.tivo.com/csingh/wiremock:3.2" already present on machine Warning BackOff 13s (x6 over 66s) kubelet Back-off restarting failed container wiremock-deployment in pod wiremock-deployment-7df659fcc4-smj9s_aps-wiremock-k8-deployment(5bfce9dd-8fd0-4e21-8315-4b012dedc4a4)
@Lee Turner Any inputs would be appreciated.
l
I am not sure what the problem could be to be honest. I have never used WireMock in k8s before and the error doesn't give us much to go on unfortunately. Where did the error message come from? Was this from the logs for the pod?
c
Yes, it is pod log.
l
It seems that you are already trying everything the people in the github issue already tried. I assume the
keystore.p12
file is present and accessible ?
c
yes keystore.p12 file is present, checked that it is of PKCS12 format. Also keystore.p12 file and keystore-password are part of secret and volume mounted in pod container
It got resolved after certain good attempts and https is working for k8 deployment of wiremock.
l
Amazing. Great news. Would you be able to explain what the solution was ?
r
@Chandra Singh would you be able to please suggest how you got it working. I am struggling with similar issue , tried jks , p12 but nothig works