# GKE, crd.yaml size error when applying

**URL:** <https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177>\
**Category:** Percona Operator for MongoDB\
**Created:** [August 3, 2023, 2:10pm UTC](https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177 "2023-08-03T14:10:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [August 3, 2023, 2:10pm UTC](https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177/1 "2023-08-03T14:10:25Z")

</div>

## Description:

kubectl apply -f [https://raw.githubusercontent.com/percona/percona-server-mongodb-operator/v1.14.0/deploy/crd.yaml](https://raw.githubusercontent.com/percona/percona-server-mongodb-operator/v1.14.0/deploy/crd.yaml)

[customresourcedefinition.apiextensions.k8s.io/perconaservermongodbbackups.psmdb.percona.com](http://customresourcedefinition.apiextensions.k8s.io/perconaservermongodbbackups.psmdb.percona.com) configured  
[customresourcedefinition.apiextensions.k8s.io/perconaservermongodbrestores.psmdb.percona.com](http://customresourcedefinition.apiextensions.k8s.io/perconaservermongodbrestores.psmdb.percona.com) configured  
Warning: resource customresourcedefinitions/perconaservermongodbs.psmdb.percona.com is missing the [kubectl.kubernetes.io/last-applied-configuration](http://kubectl.kubernetes.io/last-applied-configuration) annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.

The CustomResourceDefinition “[perconaservermongodbs.psmdb.percona.com](http://perconaservermongodbs.psmdb.percona.com)” is invalid: metadata.annotations: Too long: must have at most 262144 bytes

## Version:

Operator 1.14.0

## Expected Result:

No errors

## Actual Result:

See description

## Additional Information:

If using --server-side, there will be no errors. But if applying cr.yaml then you get this issue

error: error validating “generated-luz-mongodb-01-cluster.yaml”: error validating data: ValidationError(PerconaServerMongoDB.spec.replsets[0].expose): unknown field “clusterServiceDNSMode” in com.percona.psmdb.v1.PerconaServerMongoDB.spec.replsets.expose; if you choose to ignore these errors, turn validation off with --validate=false

which needs to be fixed with --validate=false

which then can cause other issues, because validation is turned off.

=\> pls make the crd.yaml pass the size check !

---

<div class="post-metadata">

**Author:** ![Parag\_Bhayani](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/parag_bhayani/32/3710_2.png) [@Parag\_Bhayani](https://forums.percona.com/u/Parag_Bhayani)\
**Post date:** [August 3, 2023, 3:35pm UTC](https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177/2 "2023-08-03T15:35:49Z")

</div>

Hi @jamoser ,

For installing CRD, kindly follow the steps mentioned in [Percona documentation](https://docs.percona.com/percona-operator-for-mongodb/kubernetes.html). Post that if you still face issue, kindly let us know.

For cr.yaml validation, “clusterServiceDNSMode” should be under “spec:” section instead of “spec.replsets.expose”. Kindly refer the [link](https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr.yaml) for cr.yaml.

Regards,  
Parag

---

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [August 3, 2023, 3:40pm UTC](https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177/3 "2023-08-03T15:40:11Z")

</div>

You should read my post more carefully:

–server-side

creates more problems then it solves. The issue why this has to be used is because the crd.yaml is **too large**.

---

<div class="post-metadata">

**Author:** ![Mehdi\_BF](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mehdi_bf/32/12604_2.png) [@Mehdi\_BF](https://forums.percona.com/u/Mehdi_BF)\
**Post date:** [September 5, 2023, 9:03am UTC](https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177/4 "2023-09-05T09:03:43Z")

</div>

But what to do when we use the helm chart  
We are still facing same issue with the chart and we can’t use --server-side in that case

---

<div class="post-metadata">

**Author:** ![Mehdi\_BF](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mehdi_bf/32/12604_2.png) [@Mehdi\_BF](https://forums.percona.com/u/Mehdi_BF)\
**Post date:** [September 5, 2023, 9:23am UTC](https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177/5 "2023-09-05T09:23:13Z")

</div>

Found it !

```auto
apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  syncPolicy:
    syncOptions:
    - ServerSideApply=true

```

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [September 12, 2023, 8:22am UTC](https://forums.percona.com/t/gke-crd-yaml-size-error-when-applying/24177/6 "2023-09-12T08:22:40Z")

</div>

@jamoser validation passes fine if you deploy the crd with --server-side on a fresh installation. If you try to apply it without it and then add a server-side validation error would appear. It is just how k8s works.

The size of the CRD is bigger as we are using openAPI to validate CRDs as the best practice.

@Mehdi_BF you are right, this is the way to go. I have a blog post it here for PostgreSQL and ArgoCD: [Deploy PostgreSQL on Kubernetes Using GitOps and ArgoCD](https://www.percona.com/blog/deploy-postgresql-on-kubernetes-using-gitops-and-argocd/)
