How rsalesfreitas/kubernetes-deploy-go works
Project type and purpose
• This is not a full-stack web app but a single-service Go application whose primary goal is to illustrate a CI/CD workflow via Rancher Pipeline. The key use case is: commit Go code → pipeline builds and tests → produces a Docker image → deploys to Kubernetes.
File structure
• Top-level files:
• .rancher-pipeline.yml → Rancher CI/CD pipeline definition
• Dockerfile → containerize the Go binary
• deployment.yaml → Kubernetes manifest to deploy the container
• main.go / main_test.go → the Go “hello-server” source & unit test
• No separate frontend or external libraries—this is a single microservice with a CI/CD focus.
Architecture components
a. Source Code Repository (GitHub/GitLab/etc.)
b. Rancher Pipeline Server
c. Build Agent / Runner
d. Go Build & Test Step
e. Docker Build & Push Step
f. Container Registry (Docker Hub / Private Registry)
g. Kubernetes Cluster (API Server, Nodes, Pods)
h. “hello-server” Pod & Service (as described in deployment.yaml)
i. External Traffic (LoadBalancer or Ingress)
Relationships and data flow
1. Developer pushes code to the Source Repository
2. Rancher Pipeline Server is notified (webhook)
3. Build Agent checks out code
4. Agent runs go build & go test (main.go, main_test.go)
5. On success, Agent uses Dockerfile to build an image
6. Agent pushes image to the Container Registry
7. Pipeline applies deployment.yaml to the Kubernetes Cluster
8. Kubernetes API schedules a Pod running the new image
9. External Traffic (user requests) → LoadBalancer/Ingress → Cluster Service → Pod
Architectural patterns & design principles
• CI/CD pipeline pattern (build-test-deploy)
• Immutable artifacts (Docker images)
• Declarative infrastructure (Kubernetes manifests)
• Separation of concerns: build/test vs. deploy vs. run
Layer 1: Developer & Source Control
Layer 2: Rancher Pipeline (Webhook → Build Agent → Steps)
Layer 3: Container Registry
Layer 4: Kubernetes Cluster (API Server → Nodes → Pods & Services)
Layer 5: External Users or LoadBalancer