<p>When deploying Prisma to Kubernetes locally and trying to connect through another pod, it prompts the next message: &quot;Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set.&quot;</p>
<p>The complete log is as follows:</p>
<pre><code>PrismaClientKnownRequestError: 
[be-auth] Invalid `prisma.user.create()` invocation in
[be-auth] /usr/src/app/src/routes/signup.ts:38:36
[be-auth] 
[be-auth]   35 
[be-auth]   36 const hashedPassword = await Password.toHash(password);
[be-auth]   37 
[be-auth] → 38 const user = await prisma.user.create(
[be-auth] Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set. https://pris.ly/d/mongodb-replica-set
[be-auth]     at zr.handleRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:122:8308)
[be-auth]     at zr.handleAndLogRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:122:7697)
[be-auth]     at zr.request (/usr/src/app/node_modules/@prisma/client/runtime/library.js:122:7307) {
[be-auth]   code: 'P2031',
[be-auth]   clientVersion: '5.0.0',
[be-auth]   meta: {}
[be-auth] }
</code></pre>
<p>This is the .yaml file for deploying the mongodb image:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: be-auth-mongo-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: be-auth-mongo
  template:
    metadata:
      labels:
        app: be-auth-mongo
    spec:
      containers:
        - name: be-auth-mongo
          image: mongo

---
apiVersion: v1
kind: Service
metadata:
  name: be-auth-mongo-srv
spec:
  selector:
    app: be-auth-mongo
  ports:
    - name: db
      protocol: TCP
      port: 27017
      targetPort: 27017

</code></pre>

Manel
<p>To resolve your issue follow as per <a href="https://www.prisma.io/docs/concepts/database-connectors/mongodb#replica-set-configuration" rel="nofollow noreferrer">Prisma documents</a>;</p>
<blockquote>
<ol>
<li><p>Change your deployment to one with a replica set configured.(Make it <strong>Optional</strong>)</p>
</li>
<li><p>One simple way to fix your issue is to use <a href="https://www.mongodb.com/atlas/database" rel="nofollow noreferrer">MongoDB Atlas</a>/<a href="https://github.com/prisma/prisma/blob/main/docker/mongodb_replica/Dockerfile" rel="nofollow noreferrer">Docker</a>
to launch a free instance that has replica set support out of the box.</p>
</li>
<li><p>Another way is to run the replica set locally with the help of <a href="https://docs.mongodb.com/manual/tutorial/convert-standalone-to-replica-set/" rel="nofollow noreferrer">Convert a Standalone mongod to a Replica
Set</a>.</p>
</li>
</ol>
</blockquote>
<p>Also you can refer to the <strong>Medium blog</strong> written by <strong>Grigor Khachatryan</strong> on how to <a href="https://medium.com/devgorilla/deploy-prisma-with-mongodb-to-kubernetes-ccbf1daa51be" rel="nofollow noreferrer">Deploy Prisma with MongoDB to Kubernetes</a> for more information.</p>
