Skip to content

kubernetes controller using client-go to manage foo custom resource

Notifications You must be signed in to change notification settings

Rahul1804/sample-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes Controller for Foo Resources

This project demonstrates a Kubernetes controller written in Go that manages custom resources (Foo resources) and their associated Deployments in a Kubernetes cluster.

Overview

The controller watches for changes to Foo resources and ensures that corresponding Deployment objects are created, updated, or deleted based on the spec.replicas field of the Foo resource.

Features:

  • Automatically creates or updates a Deployment when a Foo resource is added or updated.
  • Deletes the associated Deployment when a Foo resource is deleted.
  • Uses Kubernetes client-go library for interacting with Kubernetes APIs.
  • Utilizes dynamic client and informers for handling custom resources.

Prerequisites

  • Kubernetes cluster (local or remote).
  • kubectl configured to communicate with your cluster.
  • Go programming language (if building or modifying the controller).
  • Docker (if containerizing the controller).

Installation and Setup

  1. Clone the repository:

    git clone git@github.com:Rahul1804/sample-controller.git
    cd sample-controller
    
  2. Create the CRD

    kubectl apply -f foo-crd.yaml
    
  3. Run the program

    go run main.go --kubeconfig=/Users/rmishra/.kube/config
    
  4. Create a foo resource to see the magic

    kubectl apply -f foo.yaml

About

kubernetes controller using client-go to manage foo custom resource

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published