Skip to content

Kubernetes Configuration Updates for MongoDB Connectivity #110

Description

@asafchen-dig

This issue tracks the necessary changes to fix the MongoDB connectivity issues.

Required Changes

  1. Create Kubernetes Manifests:
# kubernetes/mongodb.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:latest
        ports:
        - containerPort: 27017
        env:
        - name: MONGO_INITDB_DATABASE
          value: "feedbacks"
---
apiVersion: v1
kind: Service
metadata:
  name: petclinic-flaskdb
spec:
  selector:
    app: petclinic-flaskdb
  ports:
  - protocol: TCP
    port: 27017
    targetPort: 27017
  type: ClusterIP
  1. Update Application Configuration:
  • Change connection string from http://petclinic-flaskdb:27017/feedbacks to mongodb://petclinic-flaskdb:27017/feedbacks
  • Update any hardcoded URLs in the application code
  1. Deployment Steps:
  2. Create kubernetes directory in the repository root
  3. Add the mongodb.yaml manifest
  4. Update application configuration with correct MongoDB protocol
  5. Deploy the MongoDB service
  6. Verify connectivity

Verification Steps

  1. Check that MongoDB pod is running
  2. Verify service is accessible within the cluster
  3. Test the /api/clinic-feedback/count endpoint
  4. Monitor for connection errors

Related to issue: ff76e9d8-81bc-11f0-8462-168ae57aaddf

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions