- Starting Minikube
- Ensure Minikube is running:
minikube start
- Ensure Minikube is running:
- kubectl Commands
- Get cluster information:
kubectl cluster-info
- List nodes:
kubectl get nodes
- List namespaces:
kubectl get namespaces
- Access the Kubernetes dashboard
minikube dashboard
- Get cluster information:
-
Tag
my-fast-api:1.0
image to<docker-hub-username>/my-fast-api:1.0
docker tag my-fastapi-app:1.0 jayanth00003/my-fastapi-app:1.0
-
Log in to Docker Hub
docker login
-
Push
my-fast-api:1.0
image to your Docker Hub accountdocker push jayanth00003/my-fastapi-app:1.0
-
Creating a Deployment
- Create a simple fastapi deployment:
kubectl create deployment fastapi --image=jayanth00003/my-fastapi-app:1.0
- View the deployment and pods:
kubectl get deployments kubectl get pods
- Create a simple fastapi deployment:
-
Exposing the Deployment
-
Expose fastapi deployment as a service:
kubectl expose deployment fastapi --type=NodePort --port=8000
-
Get the service details:
kubectl get services
-
Access the fastapi service using Minikube:
minikube service fastapi
-
Forward the port:
kubectl port-forward service/fastapi 7080:8000
-
- Scaling the Deployment
- Scale fastapi deployment to 3 replicas:
kubectl scale deployment fastapi --replicas=3
- Verify the scaling:
kubectl get pods
- Scale fastapi deployment to 3 replicas:
- Updating the Deployment
- Update the fastapi image version:
kubectl set image deployment/fastapi my-fastapi-app=jayanth00003/my-fastapi-app:2.0
- Verify the update:
kubectl rollout status deployment/fastapi
- Check the pod versions:
kubectl get pods -o wide
- Update the fastapi image version:
- Manage your cluster
- Pause Kubernetes:
minikube pause
- Unpause a paused instance:
minikube unpause
- Halt the cluster:
minikube stop
- Start the cluster:
minikube start
- Delete all of the minikube clusters:
minikube delete --all
- Pause Kubernetes: