My webprotege StatefulSet has the following configuration.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: webprotege-test
labels:
app: webprotege-test
spec:
serviceName: "webprotege-service-test"
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 20Gi
replicas: 1
selector:
matchLabels:
app: webprotege-test
template:
metadata:
labels:
app: webprotege-test
spec:
containers:
#
# webprotege app
- name: webprotege-test
#image: alexmilowski/allegrograph-kubernetes:latest
image: testwebprotege:4.0.2
# Wait for database. Checks that the db is listening on port 27017.
command: ["/bin/sh"]
args: ["-c", "for i in {1..20}; do if nc -z localhost 27017; then catalina.sh run; fi; echo 'waiting for database...'; sleep 2; done; exit 1"]
volumeMounts:
- name: data
mountPath: /srv/webprotege
ports:
- containerPort: 8080
name: webprotege-http
env:
- name: webprotege.mongodb.host
value: localhost
#
# mongodb
- name: wpmongo-test
image: mongo:4.1-bionic
volumeMounts:
- name: data
mountPath: /data/db
I would like to access the mongo db container outside kubernetes using a mongodb client. How do I expose the mongodb to clients outside the kubernetes cluster. I have tried adding a containerPort but this does not seem to work.