k8s-example-apps icon indicating copy to clipboard operation
k8s-example-apps copied to clipboard

Error while creating deployment

Open rohits-splunk opened this issue 3 years ago • 6 comments

kubectl create -f deployments/mongo-deployment.yaml

error: resource mapping not found for name: "mongo" namespace: "" from "deployments/mongo-deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1" ensure CRDs are installed first

rohits-splunk avatar Oct 30 '22 02:10 rohits-splunk

Thanks for reporting the issue! These manifests are a bit outdated as the Deployment API group has since been updated to apps/v1. If you try to replace extensions/v1beta1 with apps/v1 the error should be fixed.

font avatar Nov 01 '22 18:11 font

I fixed it , thanks @font . Would you mind telling which mongo db version this app expects ? I installed the latest one and the app is complaining about.

rohits-splunk avatar Nov 01 '22 18:11 rohits-splunk

I fixed it , thanks @font . Would you mind telling which mongo db version this app expects ? I installed the latest one and the app is complaining about.

Great question! The YAML manifests should really have specified the exact mongo version by tagging the image. At the time it wasn't an issue because any mongo version worked since it didn't rely on any unique mongo features. It was mongo 3.4 at the time.

In any case, make sure to align the MongoDB NodeJS driver version used in pacman with a MongoDB version that is compatible.

font avatar Nov 01 '22 23:11 font

I am trying to install 3.4 but it wont install at all, because exact versions of other components are not know, then i tried 3.2 by following the link https://www.mongodb.com/docs/v3.2/tutorial/install-mongodb-on-ubuntu/ and it again failed due do dependencies.

Is there a possibility to upgrade the mongo used in the game along with the drivers ?

rohits-splunk avatar Nov 09 '22 17:11 rohits-splunk

To solve the version problem I ran the following commands to change the apiVersion and add the selector in the deployments

#Remplace apiVersion extensions/v1beta1 for apps/v1 for compatibility 
# Add selector name mongo
cat > deployments/mongo-deployment.yaml <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: mongo
  name: mongo
spec:
  replicas: 0
  selector:
    matchLabels:
      name: mongo
  template:
    metadata:
      labels:
        name: mongo
    spec:
      containers:
      - image: mongo
        name: mongo
        ports:
        - name: mongo
          containerPort: 27017
        volumeMounts:
          - name: mongo-db
            mountPath: /data/db
      volumes:
        - name: mongo-db
          persistentVolumeClaim:
            claimName: mongo-storage
EOF


#Remplace apiVersion extensions/v1beta1 for apps/v1 for compatibility
# Add selector name pacman
cat > deployments/pacman-deployment.yaml <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: pacman
  name: pacman
spec:
  replicas: 0
  selector:
    matchLabels:
      name: pacman
  template:
    metadata:
      labels:
        name: pacman
    spec:
      containers:
      - image: quay.io/ifont/pacman-nodejs-app:latest
        name: pacman
        ports:
        - containerPort: 8080
          name: http-server
EOF

aespindola09 avatar Nov 11 '22 14:11 aespindola09

Thanks , i was able to this as well. I am not sure if i am able to see any changes in the mongodb version !!

rohits-splunk avatar Nov 11 '22 14:11 rohits-splunk