Skip to content

Conversation

asafchen-dig
Copy link

This PR updates the MongoDB connection string to use the Kubernetes service DNS name for petclinic-flaskdb service.

The petclinic-flaskdb deployment manifest should be created in a separate PR due to some technical limitations with file creation.

@asafchen-dig
Copy link
Author

Due to technical limitations with file creation, the deployment manifest for petclinic-flaskdb needs to be created manually. Here's the content that should be added in a new file (e.g., deploy/petclinic-flaskdb.yaml):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: petclinic-flaskdb
  labels:
    app: petclinic-flaskdb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: petclinic-flaskdb
  template:
    metadata:
      labels:
        app: petclinic-flaskdb
    spec:
      containers:
      - name: mongodb
        image: mongo:4.4
        ports:
        - containerPort: 27017
        env:
        - name: MONGO_INITDB_DATABASE
          value: "petclinic"
---
apiVersion: v1
kind: Service
metadata:
  name: petclinic-flaskdb
spec:
  selector:
    app: petclinic-flaskdb
  ports:
  - port: 27017
    targetPort: 27017
  type: ClusterIP

This manifest will create:

  1. A MongoDB deployment running version 4.4
  2. A Kubernetes service named petclinic-flaskdb that exposes port 27017
  3. The service uses the same name that we configured in the application.properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant