Search code examples
kubernetesminikubeagones

Kubectl error upon applying agones fleet: ensure CRDs are installed first


I am using minikube (docker driver) with kubectl to test an agones fleet deployment. Upon running kubectl apply -f lobby-fleet.yml (and when I try to apply any other agones yaml file) I receive the following error:

error: resource mapping not found for name: "lobby" namespace: "" from "lobby-fleet.yml": no matches for kind "Fleet" in version "agones.dev/v1"
ensure CRDs are installed first

lobby-fleet.yml:

apiVersion: "agones.dev/v1"
kind: Fleet
metadata:
  name: lobby
spec:
  replicas: 2
  scheduling: Packed
  template:
    metadata:
      labels:
        mode: lobby
    spec:
      ports:
      - name: default
        portPolicy: Dynamic
        containerPort: 7600
        container: lobby
      template:
        spec:
          containers:
          - name: lobby
            image: gcr.io/agones-images/simple-game-server:0.12 # Modify to correct image

I am running this on WSL2, but receive the same error when using the windows installation of kubectl (through choco). I have minikube installed and running for ubuntu in WSL2 using docker.

I am still new to using k8s, so apologies if the answer to this question is clear, I just couldn't find it elsewhere.

Thanks in advance!


Solution

  • In order to create a resource of kind Fleet, you have to apply the Custom Resource Definition (CRD) that defines what is a Fleet first.

    I've looked into the YAML installation instructions of agones, and the manifest contains the CRDs. you can find it by searching kind: CustomResourceDefinition.

    I recommend you to first try to install according to the instructions in the docs.