- 🐳 Setting up Colima for Kubernetes Development
- 🍺 Installing Homebrew
- ☸️ Installing kubectl
- ☸️ Installing Colima
- 🐳 Installing Portainer in Kubernetes
- ☸️ Installing Kubernetes Dashboard
- 🤖 Installing Jenkins
Colima is a container runtime for macOS that provides a lightweight and fast environment for running containers. It supports Kubernetes, making it a great choice for local development.
- macOS
- Homebrew (package manager for macOS)
Before installing Colima, you'll need Homebrew package manager. Here's how to install it:
- Install Homebrew
Before installing Colima, you'll need Homebrew package manager. Here's how to install it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Add Homebrew to PATH
For MacOS with Apple Silicon (M1/M2):
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc source ~/.zshrc
For Intel Mac:
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zshrc source ~/.zshrc
-
Verify Installation
brew --version
Before proceeding with Kubernetes setup, you'll need kubectl command-line tool:
-
Install kubectl
brew install kubectl
-
Verify Installation
kubectl version --client
-
Enable kubectl Shell Completion (optional)
For zsh users:
echo '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc source ~/.zshrc
For bash users:
echo 'source <(kubectl completion bash)' >> ~/.bashrc source ~/.bashrc
-
Install Colima
brew install colima
-
Start Colima with Kubernetes Support
colima start --with-kubernetes
-
Verify Installation
kubectl get nodes
Start Colima
colima start --with-kubernetes
Stop Colima
colima stop
Delete Colima Instance
colima delete
To check Colima status:
colima status
To view Colima logs:
colima logs
Portainer provides a web interface to manage your Kubernetes cluster. Follow these steps to install it:
-
Create Portainer Namespace and RBAC
First, apply the cluster role binding that gives Portainer the necessary permissions:
kubectl apply -f portainer-cluster-admin-role.yaml
-
Deploy Portainer
Deploy Portainer using the deployment configuration:
kubectl apply -f portainer-deployment.yaml
-
Verify the Installation
Check if Portainer pods are running:
kubectl get pods -n portainer
You should see output similar to:
NAME READY STATUS RESTARTS AGE portainer-xxx-xxx 1/1 Running 0 1m
-
Access Portainer UI
Once deployed, you can access Portainer at:
- URL:
http://localhost:30777
- Default credentials:
- Username:
admin
- Password: You'll be prompted to create one on first login
- Username:
- URL:
The installation consists of:
- A Kubernetes namespace called
portainer
- A deployment running the Portainer container
- A NodePort service exposing port 30777
- A PersistentVolumeClaim for data persistence
- RBAC configuration for cluster management
To check Portainer's status:
# Check pods
kubectl get pods -n portainer
# Check service
kubectl get svc -n portainer
# View Portainer logs
kubectl logs -n portainer deployment/portainer
The Kubernetes Dashboard provides a web UI to manage your cluster. Here's how to install and access it:
-
Create Installation Script
Create a file named
install-kubernetes-dashboard.sh
:// filepath: install-kubernetes-dashboard.sh #!/bin/bash # Create the dashboard namespace if it doesn't exist kubectl create namespace kubernetes-dashboard # Apply the admin role binding kubectl apply -f kubernetes-dashboard-admin-role.yaml # Install Kubernetes Dashboard kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml # Wait for the pod to be ready echo "Waiting for dashboard pod to be ready..." kubectl wait --namespace kubernetes-dashboard \ --for=condition=ready pod \ --selector=k8s-app=kubernetes-dashboard \ --timeout=90s # Get the token echo "Generating token..." kubectl -n kubernetes-dashboard create token admin-user
-
Run Installation Script
Make the script executable and run it:
chmod +x install-kubernetes-dashboard.sh ./install-kubernetes-dashboard.sh
This script will:
- Create the kubernetes-dashboard namespace
- Apply the admin role configuration
- Install the dashboard components
- Wait for the dashboard to be ready
- Generate and display an access token
⚠️ Important: Save the token displayed in the output - you'll need it to log in -
Start the Dashboard Proxy
kubectl proxy
-
Access the Dashboard
Open the following URL in your browser:
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
📝 Alternative Access Method
You can also use port forwarding instead of proxy:kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443
Then access the dashboard at:
https://localhost:8443
Note: You'll need to accept the self-signed certificate warning in your browser. -
Login
- Select "Token" as authentication method
- Paste the token from step 2
- Click "Sign In"
Jenkins can be deployed in your Kubernetes cluster using the provided configuration. Here's how to install and access it:
-
Deploy Jenkins
Apply the Jenkins configuration:
kubectl apply -f jenkins.yaml
This will create:
- Jenkins namespace
- Persistent Volume Claim (10Gi)
- Jenkins deployment
- NodePort service
-
Wait for Jenkins to Start
Check the pod status:
kubectl get pods -n jenkins
Wait until the pod status shows
Running
. -
Get Initial Admin Password
kubectl exec -n jenkins $(kubectl get pods -n jenkins -o jsonpath='{.items[0].metadata.name}') -- cat /var/jenkins_home/secrets/initialAdminPassword
-
Access Jenkins
Open in your browser:
http://localhost:30000
📝 Port Information
The configuration exposes two ports:- Web UI:
30000
(http://localhost:30000) - Agent Port:
30001
(for Jenkins agents)
- Web UI:
-
Complete Installation
- Enter the initial admin password from step 3
- Install suggested plugins
- Create your admin user
- Start using Jenkins
Check Jenkins status:
# View pod status
kubectl get pods -n jenkins
# Check logs
kubectl logs -n jenkins deployment/jenkins
# Check service
kubectl get svc -n jenkins