Topic: golang

Mastering Kubernetes Operators: A Wordpress Case Study | Golang Operator | Part One

What is a Kubernetes Operator? In short and straightforward terms, a Kubernetes Operator is a webhook that continuously listens for particular resource events. Developers can write logic, known as the Reconcile logic, to determine the next steps that should occur when these events happen. For example, let's consider a Wordpress application. To deploy this on Kubernetes, we need to create MySQL instances and a Wordpress site instance, and then expose the Wordpress service URL. This process involves manual intervention, but we can automate these tasks whenever our application deployment is applied. Prerequisites Before we start, make sure you have the following installed: Docker Minikube Operator SDK Golang (1.21.0) I beleive your minikube is started Step 1: Initialize the Operator First, let's generate the code and structure for our Operator: operator-sdk init --domain gopkg.blogpost.com --repo github.com/vyas-git/wordpress-operator Step 2: Create Wordpress Controlle...
Read article →

Mastering Kubernetes Operators: A Wordpress Case Study | Golang Operator | Part Two

Welcome back to the second part of our series on building a Kubernetes operator for managing WordPress deployments! In the first part, we laid the foundation by setting up the basic structure of our operator and defining custom resources. Now, it's time to take the next step and enhance our operator to automate the deployment and management of WordPress and MySQL instances within a Kubernetes cluster. In this installment, we'll focus on updating our WordPress controller to create deployments and services for both WordPress and MySQL. By the end of this guide, you'll have a fully functional operator capable of handling the complexities of deploying and maintaining WordPress applications in a Kubernetes environment. So, let's dive in and continue our journey of empowering Kubernetes with the capabilities of our custom operator! Step 1: Create `wordpress.go` in `internal/controller` In this step, we'll create a `wordpress.go` file within the `internal/controller` dire...
Read article →