---
title: "Develop Kubernetes Operators in Java without Breaking a Sweat"
description: "Kindcontainer, a Testcontainers extension, enables integration testing of Java-based Kubernetes operators and controllers against real API servers running in Docker."
url: "https://swe.quest/articles/develop-kubernetes-operators-in-java-without-breaking-a-sweat-89f0aefdc48d05fa"
canonical: "https://www.docker.com/blog/develop-kubernetes-operators-in-java-without-breaking-a-sweat/"
source: "Docker"
published: "2024-06-06"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["kubernetes","testing","jvm","containers"]
---

# Develop Kubernetes Operators in Java without Breaking a Sweat

A post on [Docker](https://swe.quest/sources/docker.md), published 2024-06-06, 8 min read, How-to. Original: [https://www.docker.com/blog/develop-kubernetes-operators-in-java-without-breaking-a-sweat/](https://www.docker.com/blog/develop-kubernetes-operators-in-java-without-breaking-a-sweat/)

## Summary

Kindcontainer, a Testcontainers extension, enables integration testing of Java-based Kubernetes operators and controllers against real API servers running in Docker. It offers ApiServerContainer for fast API-server-only tests and K3sContainer/KindContainer for full single-node clusters (startup can exceed a minute), all behind a common API so tests can switch without code changes. Fluent kubectl and Helm APIs run in separate containers to install CRDs and charts before tests, Kubernetes versions are pinned via enums, and images can come from private registries. Admission webhooks running in the test JVM are reachable through an SSH reverse tunnel plus an Nginx container for TLS termination, all configured automatically.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Kubernetes](https://swe.quest/tags/kubernetes.md) (Infrastructure)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)
- [Java & JVM](https://swe.quest/tags/jvm.md) (Languages)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)

## Prerequisites

- Kubernetes operators and CRDs ([easy posts on Kubernetes](https://swe.quest/tags/kubernetes.md?difficulty=easy))
- JUnit 5
- Docker basics ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))

## Keywords

Kindcontainer, Testcontainers, JUnit 5, fabric8 Kubernetes client, K3s, kind, Helm, admission webhooks

## Related posts

- [Streamlining Local Development with Dev Containers and Testcontainers Cloud](https://swe.quest/articles/streamlining-local-development-with-dev-containers-and-testcontainers-cloud-050962d8604171c1.md): Docker · 2024-08-27 · Medium · 7 min read · Containers, Testing, Developer tools, Java & JVM
  Testcontainers-based tests and services can run inside a dev container by giving the container Docker access, either through the Docker-in-Docker feature or by swapping in the Testcontainers Cloud feature, which runs an agent that points Docker calls at a remote cloud environment.
- [Functional tests with Testcontainers](https://swe.quest/articles/functional-tests-with-testcontainers-8e8bddfb01d0b1bc.md): Zalando Engineering · 2022-04-11 · Medium · 7 min read · Testing, Java & JVM, Containers
  Black-box functional tests for a Spring service can run against the service packaged as a Docker image, with PostgreSQL and other dependencies started as separate containers via Testcontainers.
- [Leveraging Testcontainers for Complex Integration Testing in Mattermost Plugins](https://swe.quest/articles/leveraging-testcontainers-for-complex-integration-testing-in-mattermost-plugins-3edaea4757026529.md): Docker · 2024-10-08 · Medium · 6 min read · Testing, Containers, Go, JavaScript
  Mattermost replaced brittle mock-based plugin tests with Testcontainers-driven integration tests that spin up a Mattermost server, PostgreSQL on an internal Docker network, and optional API mock containers.
- [Why Testcontainers Cloud Is a Game-Changer Compared to Docker-in-Docker for Testing Scenarios](https://swe.quest/articles/why-testcontainers-cloud-is-a-game-changer-compared-to-docker-in-docker-for-206c0ecf09c497e2.md): Docker · 2024-11-14 · Medium · 8 min read · Testing, CI/CD, Containers
  Docker-in-Docker, commonly used to give CI jobs a Docker daemon for Testcontainers integration tests, requires privileged mode and nests storage drivers, cgroups and namespaces, which leads to security audit problems, flaky builds, slow pipelines and hard debugging.
- [Building an End to End load test automation system on top of Kubernetes](https://swe.quest/articles/building-an-end-to-end-load-test-automation-system-on-top-of-kubernetes-7beb3707dbd053ca.md): Zalando Engineering · 2021-03-01 · Medium · 9 min read · Testing, Performance engineering, Kubernetes, Payments & fintech, Capacity planning
  Zalando's payments team built an automated end-to-end load testing system in its Kubernetes test cluster.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
