Questions tagged [kubernetes-custom-resources]
123 questions
4
votes
1 answer
How to create Kubernetes objects with Status fields?
I am using the kubernetes operator to create a custom resource in the cluster, the CR has the Status field populated, but when the object gets created the Status field is empty.
This is how I am creating the CR:
reconcile.Create(ctx, &object)
This…

Vishrant
- 15,456
- 11
- 71
- 120
4
votes
2 answers
Restricted user in K8s need CRD's access
In my scenario user has access to four namespaces only, he will switch between namespaces using contexts below. How can I give him access to CRD's along with his exiting access to four namespaces.
CURRENT NAME CLUSTER …

Jay
- 41
- 1
- 3
4
votes
1 answer
Kubernetes: Why does patching a custom resource's /status subresource update the parent resource?
I'm trying to understand Kubernetes behaviour as it pertains to custom resources and their subresources -- specifically the status subresource.
Specifically, I want to update the status subresource without modifying the parent custom resource.
To…

Brian Warsing
- 81
- 1
- 5
4
votes
1 answer
Kubernetes CRDs - Reference existing validation spec
Is there a way to access existing validation specs? For example, I want to be able to set NodeAffinity on my CRD, and would like to just $ref: . I found the entire API here:…

user2896438
- 795
- 13
- 21
3
votes
1 answer
Properly using oneOf in a Kubernetes CRD OpenAPI schema
I am trying to describe mutually exclusive properties in an OpenAPI v3 schema.
I have a custom resource that can take a property widgetName, a name of a Widget resource, or widgetDefinition, an inline Widget definition. That is, this is…

larsks
- 277,717
- 41
- 399
- 399
3
votes
0 answers
Reconcile triggers again on creating a secret owned by custom resource
I used the operator-sdk to create a custom resource DatabaseService. Creation a DatabaseService CR should trigger the Reconcile function that would create a secret in the CR namespace after getting it from a third party.
I set the CR as the owner of…

Alechko
- 1,406
- 1
- 13
- 27
3
votes
1 answer
Using client-go to explain a resource
Using kubectl I can show documentation for a resource using explain:
kubectl explain storageclass
Is there similar functionality available with client-go?

Trevor
- 6,659
- 5
- 35
- 68
3
votes
1 answer
Kubernetes operator create Deployment using yaml template
I am trying my hands on creating my own kubernetes operator by following this link. In the Reconcile function, I need to create multiple Deployments and each will vary in some attributes (like name for e.g.) and the configuration is huge. Instead of…

Vishal
- 549
- 3
- 13
3
votes
1 answer
How to display a kubectl column using a fraction format (i.e. X/Y) for a Custom Resource
In Kubernetes, is it possible to display a column using a fraction format (i.e. X/Y) using the "additionalPrinterColumns" field of a CRD?
More precisely, I would like kubectl to display the description of a CR field using the same format than the…

Fabrice Jammes
- 2,275
- 1
- 26
- 39
3
votes
0 answers
Kubernetes Yaml with CRD Resource and CRD object
I have a single yaml file having CustomResourceDefinition and CRD object. But when I am trying to apply the yaml then sometimes crd object creation failed with kind DemoRule not present.
Tried to apply separately and it worked fine. Is there any way…

Sumit Khanna
- 41
- 5
3
votes
1 answer
Maximum Size of Status in the Kubernetes CRD?
Is there a limit on the size of Kubernetes spec and status size in Kubernetes?
I have a use case in which the operator spec is a regular expression and regex gets expanded to a lot of actual items whose status I have to store.
Example:
type…

Alok Kumar Singh
- 2,331
- 3
- 18
- 37
3
votes
2 answers
Dynamic key/value input properties to CRD in Kubernetes
While defining a K8 CRD, I need a flexibility to pass any key/value pairs as input while submitting a resource object.
https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/
schema:
openAPIV3Schema:
…

colossal
- 529
- 1
- 5
- 22
3
votes
1 answer
Best Practice for Operators for how to get Deployment's configuration
I am working on operator-sdk, in the controller, we often need to create a Deployment object, and Deployment resource has a lot of configuration items, such as environment variables or ports definition or others as following. I am wondering what is…

Joe
- 307
- 1
- 11
3
votes
1 answer
How to check if a field was explicitly set in a custom resource
Update:
I found that my code actually working. The reason that reconcile loop get false at first is because I have another operator existing in my cluster and doing boolean flipping automatically. After deleted that operator, my code works as…

Haoming Zhang
- 2,672
- 2
- 28
- 32
3
votes
1 answer
kubernetes: validating a yaml file against a custom resource
Assuming I have a custom resource on my k8s cluster exposed on a proprietary api endpoint, e.g. somecompany/v1
Is there a way to validate a .yaml manifest describing this resource?
It his a functionality the custom resource provider should expose or…

pkaramol
- 16,451
- 43
- 149
- 324