Build a Kubernetes operator in Go with Kubebuilder that gives product teams self-service PostgreSQL access: teams declare databases and users as custom resources, and the operator creates them as a non-superuser role, delivers generated credentials as Secrets, rotates them, repairs drift, refuses mistakes at admission and cleans up safely, on kind and on Amazon EKS with Amazon RDS.
Kubernetes Engineer. Advanced.
In this project you build a Kubernetes operator in Go: a program that runs in the cluster and turns two small YAML objects into a working PostgreSQL database, login roles with exactly the right privileges, and a Secret your application can mount. You will run it on a local kind cluster against PostgreSQL 18, and, as an optional milestone, on Amazon EKS against Amazon RDS.
This page explains how the operator works as a whole: what each part does, what moves between the parts, and why the design looks the way it does. The technology lessons go deeper into each tool, and the source guides go file by file. This page should make sense without either.
A DBA at Brackwater once revoked a user's access to fix an incident and forgot to give it back. The service ran degraded for two days before anyone connected the errors to the revoke. The ticket that originally created the user said what access it should have; nothing ever compared that statement with the server again.
The first draft of this API had a single resource, DatabaseAccess, with the server address, the database name, a list of users and their passwords in one object. It was easy to write and impossible to make safe:
The reporting team's first database user, created by hand two years ago, owned half the tables in its database. It had created them during a migration and nobody noticed. When the reporting service was retired and the user dropped, PostgreSQL refused: the role still owned objects. The DBA reassigned them to the next user, which later created more tables of its own, and the knot grew.
The first version of the DatabaseUser reconciler created the role and then the Secret, and returned. It worked in every demo. In the first real test the operator restarted between the two steps. On the next pass the role already existed, CREATE ROLE failed, the reconciler returned an error, and it kept failing with backoff until someone deleted the role by hand.
Brackwater's security review found a database password in a two-year-old chat thread. It still worked. Nobody knew which services used it, so nobody dared to change it.
An engineer at Brackwater cleaned up an old test namespace with kubectl delete namespace billing-test. The namespace contained a Database for a scratch copy of the invoices data, and nothing else. The question the platform team asked afterwards was: what should have happened to the database on the server? The answer depends on what the object said. The operator has to get it right every time, including when it is restarting, when the server is down, and when two objects claim
When the operator first went live, a billing engineer copied the routing team's Database manifest as a starting point and forgot to change databaseName. The object was accepted. A minute later it reported NameConflict in its status, which nobody looked at, and the billing service failed to start for an afternoon.
An operator holds two kinds of credentials:
An operator sits between Kubernetes and an external system. That makes it unusually easy to test the wrong thing:
The operator works on your computer under make run. Getting it into a cluster raises new questions:
On kind, everything is under your control: the cluster, the PostgreSQL server, its CA and its superuser. On AWS, the database is Amazon RDS:
Writing the operator took weeks. Running it will take years: new Kubernetes versions, new fields teams ask for, a rotated admin password, a new server, a team that leaves. This lesson covers the tasks that come after the first deployment:
This guide takes you from the downloaded source to the operator managing real PostgreSQL access in two places: first a local kind cluster with a PostgreSQL 18 server inside it, which costs nothing, and then, as an optional milestone, one small Amazon EKS cluster against Amazon RDS for PostgreSQL. The cleanup guide removes both again.
Almost every problem with this operator first shows up as a Ready=False condition somewhere in a short chain: a user waits on its database, a database waits on its server, a server waits on its Secrets and the network. The first useful question is always: where in that chain is the first False, and what does its message say? The answer usually separates a Kubernetes problem (admission, RBAC, a Secret) from a PostgreSQL problem (TLS, a password, a privilege) before you open a
An interview about this project rarely asks "what does the code do?". It asks why you chose this design over the obvious alternatives, and what happens when something fails. The question bank has twenty questions in five areas: architecture, API and reconciliation, PostgreSQL and credentials, security, and testing and operations. Each has a model answer and the talking points an interviewer listens for.
The project has two labs with separate cleanups. The kind lab lives only in Docker on your computer and costs nothing, but it holds several gigabytes of images. The EKS milestone costs about USD 0.26 per hour until it is gone. Remove it as soon as you have finished. Both cleanups work whether or not the deployment finished.
Before any cluster exists, you build the container that holds every tool, and run the checks that guard every change to the operator. Nothing in this milestone costs money or needs an AWS account.
You create a kind cluster with two nodes, install cert-manager, and run a PostgreSQL 18 server that accepts only TLS connections. This is the environment the operator will manage. It plays the role that Amazon RDS plays in the EKS milestone.
You build the operator image, load it into the cluster's nodes, and deploy it with its CRDs, RBAC, validating webhook and the webhook's certificate. At the end, one operator pod runs, holds the leader lease, and serves the webhook.
You act as the platform team, registering the server and labelling which namespaces may use it, and then as two product teams asking for databases and users. Then a client pod connects with the credentials the operator delivered, and the end-to-end suite exercises everything.
You choose a prefix and a Region, sign in, and create everything the EKS milestone needs: a state bucket, a VPC, an EKS cluster with two Graviton nodes, an ECR repository and an RDS for PostgreSQL 18 instance in private subnets. This is the first step that costs money, about USD 0.26 per hour until cleanup finishes.
You push the operator image to ECR, install cert-manager, create the operator's own role on RDS through a one-time Job, deploy two replicas with the EKS overlay, and register RDS as the PostgresServer. Then a short verification proves it works, and you can release and roll back.
You destroy the EKS milestone in reverse order, check that nothing billable remains, delete the kind cluster, and remove the images and caches from your computer.
Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.
AWS usage is separate from project access. The kind lab runs on your computer and costs nothing. The optional EKS milestone costs about USD 0.26 per hour in ap-south-1 at on-demand prices (an EKS control plane, two m7g.large nodes, an RDS db.t4g.micro instance, public IPv4 addresses and storage); a two-hour session costs about USD 0.55. Charges continue until cleanup finishes. This is a learning reference, not a hosted lab or a production-readiness guarantee.
Vectametric Project Source Licence (2026-09-27): lawfully obtained source may be copied, modified and deployed for personal learning and interview preparation, including personal portfolio demonstrations with attribution. These permissions continue after online access expires. Do not resell or redistribute the Source Pack or its original source files, unchanged or modified. Commercial or client production use requires separate written permission. Third-party components downloaded when building or running the lab, such as the Go modules in go.mod, Go, Kubebuilder, controller-gen, kind, kubectl, cert-manager, PostgreSQL, Terraform and its AWS provider, the AWS CLI, golangci-lint and govulncheck, retain their own licences; several files began as output of Kubebuilder's Apache-2.0 project templates. See LICENSE.txt and the Project Source Licence section of the site Terms for the full rules.
You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.
Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.
No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.
The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.
The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.
Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.
Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy