Questions tagged [kubernetes-operator]

A Kubernetes operator is a pair of a custom resource definition (CRD) and a controller program for acting on that custom resource. Use this tag for questions about writing controller code and other details of implementing operators.

A Kubernetes operator is a pair of a custom resource definition (CRD) and a controller. The controller is a program that runs inside the Kubernetes cluster and uses the Kubernetes API to monitor instances of that custom resource and take some action. This provides a path to extend Kubernetes by adding your own custom objects to the API.

Controllers are frequently written in , though this is not a hard requirement. is one popular toolkit for this, maintained by the Kubernetes project.

Use the tag for questions about writing your own operator. It will generally be correct to also tag questions with and the tag for your implementation language, and for your toolkit if it has its own tag.

Note that, as with all Stack Overflow questions, questions about Kubernetes operators must be programming-related. Questions about installing or using a prebuilt operator are off-topic for Stack Overflow, and might be better asked on another Stack Exchange site like DevOps.SE or Server Fault.

151 questions
12
votes
1 answer

Is there a way to force delete a crd with failing webhooks?

The kubedb operator in this case has crashed and un-responsive - however I need to cleanup these resources. k delete redis r1 redis-queue --namespace cts --force --grace-period=0 warning: Immediate deletion does not wait for confirmation that the…
user2062360
  • 1,323
  • 5
  • 16
  • 29
9
votes
3 answers

How to trigger a Kubernetes controller reconciler for an arbitrary object?

Overview I am writing a Kubernetes controller for a VerticalScaler CRD that can vertically scale a Deployment in the cluster. My spec references an existing Deployment object in the cluster. I'd like to enqueue a reconcile request for a…
Adam Snyder
  • 405
  • 1
  • 5
  • 7
9
votes
1 answer

Kubernetes Operator (Operator SDK, Kubebuilder VERSUS Kubernetes Client Libraries)

I am sorry if this question has been answered but after trying many different ways of googling for an answer, I have failed to get a definitive explanation so I am trying to seek clarifications here. I am familiar with the operator/controller…
KSheng
  • 147
  • 2
  • 9
9
votes
1 answer

How to use connection hooks with `KubernetesPodOperator` as environment variables on Apache Airflow on GCP Cloud Composer

I'd like to use connections saved in airflow in a task which uses the KubernetesPodOperator. When developing the image I've used environment variables to pass database connection information down to the container, but the production environment has…
8
votes
2 answers

Elasticsearch 7.2.0: master not discovered or elected yet, an election requires at least X nodes

I'm trying to automate the process of horizontal scale up and scale down of elasticsearch nodes in kubernetes cluster. Initially, I deployed an elasticsearch cluster (3 master, 3 data & 3 ingest nodes) on a Kubernetes cluster. Where,…
Kamol Hasan
  • 12,218
  • 1
  • 37
  • 46
6
votes
2 answers

Enforcing immutability of Kubernetes custom resource spec fields

I'm using the Kubernetes golang operator sdk to implement an operator that manages RabbitMQ queues. I'm wondering if there's a way for k8s to enforce immutability of particular spec fields on my custom resource. I have the following golang struct…
wangdrew
  • 133
  • 5
5
votes
1 answer

Kubernetes Operators: Informers vs. reconcile loop

I recently got started with building a Kubernetes operator. I'm using the Fabric8 Java Kubernetes Client but I think my question is more general and also applies to other programming languages and libraries. When reading through blog posts,…
5
votes
1 answer

Is it okay when two K8S controllers modify same resource at the same time?

I have a few CRDs and each of them supposed to make edit Container.Spec's across the cluster. Like ENVs, Labels, etc... Is it okay, if the resource is managed by more that one controller? What are the possible pitfalls of this approach?
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…
4
votes
1 answer

MongoDB Community Kubernetes Operator and Custom Persistent Volumes

I'm trying to deploy a MongoDB replica set by using the MongoDB Community Kubernetes Operator in Minikube. I followed the instructions on the official GitHub, so: Install the CRD Install the necessary roles and role-bindings Install the Operator…
4
votes
1 answer

What is the use for CRD status?

I'm currently writing a kubernetes operator in go using the operator-sdk. This operator creates two StatefulSet and two Service, with some business logic around it. I'm wondering what CRD status is about ? In my reconcile method I use the default…
JesusTheHun
  • 1,217
  • 1
  • 10
  • 19
3
votes
0 answers

Issue with Zalando Postgres operator configuration for logical backup

The vaule-crd.yaml has the pod_environment_configmap option which injects a configmap data into every database pod as environment variables. Does this option also work for all cron jobs managed by the operator? For now, I have to hardcode the S3…
RedGiant
  • 4,444
  • 11
  • 59
  • 146
3
votes
0 answers

Reuse Airflow hooks with kubernetes operator

Is possible to import the hooks that airflow provided in the code (snowflake hook, aws hook, etc) in a kubernetes operator that run a python script? I may have the wrong idea of how to work with airflow. Example. I have Airflow running with a…
3
votes
0 answers

Scheme is Nil when testing an operator scaffolded with operator-sdk

I'm working on an early iteration of an operator, which I've scaffolded using operator-sdk. I've tried my best to follow the examples from the Operator SDK Golang Tutorial and the Kubebuilder book. I've found that I can deploy and run my operator to…
Jeff Rosenberg
  • 3,522
  • 1
  • 18
  • 38
3
votes
1 answer

Can't install operators outside of `openshift-marketplace`

Attempting to install an Operator into a single namespace foobar results in the error: Operator Group does not support single namespace installation mode. Attempting to install an Operator into all namespaces into the openshift-operators namespace…
I'll Eat My Hat
  • 1,150
  • 11
  • 20
1
2 3
10 11