Score:0

How to use open service mesh in kubernetes?

ck flag

I am trying to test open service mesh for our application.

No tags in serverfault for service mesh or servicemesh or osm or open service mesh,etc. So I kept istio as serverfault tag to this question as it is also a similar product of service mesh.

So, installed the osm cli on my laptop using this link

In my kubernetes (minikube), installed the osm using:

osm install

This installed osm in the namespace osm-system

osm pods

Then installed the sample application provided by them using their documentation

Their bookstore app working fine.

My spec.traffic.enablePermissiveTrafficPolicyMode is still true so no rules required and by default all traffic should be allowed by default.

So for testing, I did try on mondo-express and mongo containers.

apiVersion: v1
kind: ConfigMap
metadata:
  name: mongodb-configmap
  namespace: mongosample
data:
  database_url:  mongodb-service
---
apiVersion: v1
kind: Namespace
metadata:
  name: mongosample
---
apiVersion: v1
kind: Secret
metadata:
  name: mongodb-secret
  namespace: mongosample
type: Opaque
data:
  mongo-root-username:  dXNlcm5hbWU=
  mongo-root-password:  cGFzc3dvcmQ=


##echo -n 'username' | base64
##echo -n 'password' | base64
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-express
  namespace: mongosample
  labels:
    app: mongo-express
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-express
  template:
    metadata:
      labels:
        app: mongo-express
    spec:
      imagePullSecrets:
        - name: dockerhub-secret
      containers:
        - name: mongo-express
          image: mongo-express:latest
          ports:
          - containerPort: 8081
          env:
          - name: ME_CONFIG_MONGODB_ADMINUSERNAME
            valueFrom:
              secretKeyRef:
                name: mongodb-secret
                key: mongo-root-username
          - name: ME_CONFIG_MONGODB_ADMINPASSWORD
            valueFrom:
              secretKeyRef:
                name: mongodb-secret
                key: mongo-root-password
          - name: ME_CONFIG_MONGODB_SERVER
            valueFrom:
              configMapKeyRef:
                name: mongodb-configmap
                key: database_url
---
apiVersion: v1
kind: Service
metadata:
  namespace: mongosample
  name: mongodb-express-service
spec:
  selector:
    app: mongo-express
  type: ClusterIP
  ports:
    - protocol: TCP
      port: 8081
      targetPort: 8081
      #nodePort: 30000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongodb-deployment
  namespace: mongosample
  labels:
    app: mongodb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongodb
  template:
    metadata:
      labels:
        app: mongodb
    spec:
      imagePullSecrets:
        - name: dockerhub-secret
      containers:
        - name: mongodb
          image: mongo:latest
          ports:
          - containerPort: 27017
          env:
          - name: MONGO_INITDB_ROOT_USERNAME
            valueFrom:
              secretKeyRef:
                name: mongodb-secret
                key: mongo-root-username
          - name: MONGO_INITDB_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mongodb-secret
                key: mongo-root-password
---
apiVersion: v1
kind: Service
metadata:
  namespace: mongosample
  name: mongodb-service
spec:
  selector:
    app: mongodb
  ports:
    - protocol: TCP
      port: 27017
      targetPort: 27017

And without the osm it is working fine.

no osm pods

So, enabled osm for this mongosample namespace using:

osm namespace add mongosample

After enabling and restarting pods:

osm enabled pods

And error in logs of mongo-express

error in mongo-express

If I remove service mesh to this namespace then works fine.

osm namespace remove mongosample

Please suggest how to fix that?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.