This guide walks through a production-grade Rancher setup with High Availability, multi-cluster management, and a GitOps CI/CD workflow using Kustomize.
๐ This is how you run Rancher in real-world environments—not just demos.
๐ Rancher Production Architecture
+----------------------+
| Load Balancer |
+----------+-----------+
|
+---------------+----------------+
| |
+-------------+ +-------------+
| Rancher Pod | | Rancher Pod |
+-------------+ +-------------+
| |
+---------------+----------------+
|
+------------------+
| Kubernetes (Mgmt)|
+------------------+
|
+----------------+----------------+
| |
+------------------+ +------------------+
| Cluster (Dev) | | Cluster (Prod) |
| Managed by Rancher| | Managed by Rancher|
+------------------+ +------------------+
๐ Rancher runs inside a Kubernetes cluster and manages other clusters centrally.
๐ณ CloudChef Recipe: Rancher HA Setup
๐งพ Ingredients
- 3-node Kubernetes cluster (minimum for HA)
- Helm installed
- Ingress controller (NGINX recommended)
- cert-manager installed
Step 1: Install cert-manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml
Step 2: Add Rancher Helm Repo
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo update
Step 3: Install Rancher in HA Mode
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--create-namespace \
--set hostname=rancher.yourdomain.com \
--set replicas=3
๐ replicas=3 enables High Availability.
Step 4: Configure Ingress + TLS
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: rancher
namespace: cattle-system
spec:
rules:
- host: rancher.yourdomain.com
๐ Always use HTTPS (cert-manager + Let's Encrypt).
๐ Production Hardening Checklist
- ☐ Enable TLS
- ☐ Use SSO (OIDC / Azure AD)
- ☐ Restrict RBAC
- ☐ Enable audit logging
☸️ Multi-Cluster Management
Rancher allows you to manage multiple clusters:
Steps:
- Add cluster via Rancher UI
- Import existing clusters (EKS, AKS, GKE)
- Apply policies across clusters
๐ Use labels to organize clusters (dev, staging, prod)
⚙️ GitOps CI/CD with Kustomize
We’ll deploy an application using Kustomize via Git.
๐ Repo Structure
repo/
base/
deployment.yaml
service.yaml
overlays/
dev/
kustomization.yaml
prod/
kustomization.yaml
๐ base/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: app
spec:
replicas: 2
๐ overlays/dev/kustomization.yaml
resources:
- ../../base
namePrefix: dev-
๐ overlays/prod/kustomization.yaml
resources:
- ../../base
namePrefix: prod-
๐ Deploy via Rancher (GitOps Flow)
- Connect Git repo
- Select overlay (dev/prod)
- Deploy application
๐ Rancher continuously syncs your cluster with Git.
⚠️ Common Production Mistakes
- Running Rancher with 1 replica
- No TLS configuration
- No RBAC restrictions
- No GitOps workflow
๐ง Pro Tips
- Use separate clusters for environments
- Combine Rancher + ArgoCD for GitOps
- Monitor clusters with Prometheus
๐ Final Thoughts
Rancher becomes truly powerful when combined with GitOps and HA architecture.
๐ฅ CloudChef Tip: Don’t just manage clusters—standardize them.
No comments:
Post a Comment