Skip to content

Istiak2019331114/client-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How Components Interact

1. Controller Image (istiaka2i/create-deploy:latest)

  • Built from the provided Dockerfile.
  • Contains the compiled Go controller (main.go).
  • When run, this image connects to the Kubernetes API and creates:
    • A Deployment (go-book-app) that runs the book application container (istiaka2i/bookapp:v1.0).
    • A NodePort Service (go-book-service) to expose the app.

2. Controller Pod (go-book-app-controller.yaml)

  • Defines a Pod that runs the controller image.
  • Uses the go-book-app-sa ServiceAccount for RBAC permissions.
  • When this Pod starts, it triggers the controller logic:
    • The controller creates the Deployment and Service in the cluster.

3. Book App Deployment (main.go logic)

  • Created by the controller Pod.
  • Runs the book application image: istiaka2i/bookapp:v1.0.
  • The Deployment ensures two replicas of the app are running.

4. NodePort Service (main.go logic)

  • Also created by the controller Pod.
  • Exposes the book app on port 4000 (mapped to container port 8080) and NodePort 30080.

Flow Diagram

[Controller Image: create-deploy]
           |
           v
[Controller Pod: go-book-app-controller.yaml]
           |
           v
[Controller Logic: main.go]
           |
           v
[Creates Deployment: go-book-app] ----> [Runs bookapp:v1.0]
           |
           v
[Creates Service: go-book-service] ----> [Exposes app via NodePort]

Summary

  • You build and deploy the controller image.
  • The controller Pod runs and triggers the creation of the book app Deployment and Service.
  • The book app image is pulled and run by the Deployment, and exposed by the Service.

Quickstart Commands

  1. Build Controller Image

    docker build -t istiaka2i/create-deploy:latest .
  2. Apply RBAC

    kubectl apply -f rbac.yaml
  3. Deploy Controller Pod

    kubectl apply -f go-book-app-controller.yaml
  4. Check Resources

    kubectl get pods
    kubectl get deployments
    kubectl get services

This workflow ensures that the controller image, when run as a Pod, automatically provisions your book app and exposes it in the cluster.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published