https://pulumi.com logo
#kubernetes
Title
# kubernetes
n

numerous-journalist-43638

04/05/2023, 3:22 PM
Hi, Anyone have any experience deploying a policy for the kube-descheduler? I'm trying to do so as a pulumi Custom Resource but running into the following error:
Copy code
creation failed: no matches for kind "DeschedulerPolicy" in version "descheduler/v1alpha2"
And here is my config for the policy:
Copy code
k8s.apiextensions.CustomResource(
            "descheduler-policy",
            kind="DeschedulerPolicy",
            api_version="descheduler/v1alpha2",
            metadata=k8s.meta.v1.ObjectMetaArgs(
                namespace="kube-system",
            ),
            spec={
                "profiles": [
                    {
                        "name": "default",
                        "pluginConfig": [
                            {
                                "name": "DefaultEvictor"
                            },
                            {
                                "name": "HighNodeUtilization",
                                "args": {
                                        "thresholds": {"cpu": 20, "memory": 30},
                                },
                            },
                        ],
                        "plugins": {
                            "evict": {"enabled": ["DefaultEvictor"]},
                            "balance": {"enabled": ["HighNodeUtilization"]}
                        },
                    }
                ],
            },
            opts=pulumi.ResourceOptions(
                provider=provider,
                depends_on=[
                    cluster,
                    descheduler
                ],
                parent=self,
            ),
        )
b

billowy-army-68599

04/05/2023, 3:28 PM
have you deployed the custom resource definition?
n

numerous-journalist-43638

04/05/2023, 3:36 PM
According to pulumi docs, the Custom Resource is an instance of a CRD, so I thought they were one in the same
b

billowy-army-68599

04/05/2023, 3:42 PM
not quite. a CRD extends the API inside the Kubernetes API, the Custom Resource is an instance of it
you need to create the CRD, then the CR
n

numerous-journalist-43638

04/05/2023, 4:13 PM
Do you know of any examples of a CRD deploy in pulumi docs? I can only find docs for CR.
m

many-telephone-49025

04/07/2023, 8:24 AM
@numerous-journalist-43638: DeschedulerPolicy are not a CRD, it's the internal yaml format of the descheduler. You can define them as configmap or use the helm chart value to add them
89 Views