Minikube service deployment workflow¶
The Minikube service deployment workflow involves a sequence of steps to create a Kubernetes Deployment, expose it via a service, and access the application locally.
Deployment and Exposure¶
The workflow begins by creating a deployment using kubectl create deployment, specifying a name and container image^[400-devops-06-kubernetes-minikube.md]. For example, to deploy an nginx application, you would use the image docker.io/nginx:1.23^[400-devops-06-kubernetes-minikube.md].
To make the application accessible, the deployment must be exposed as a Service^[400-devops-06-kubernetes-minikube.md]. This is typically done using the NodePort type on the desired port (e.g., port 80)^[400-devops-06-kubernetes-minikube.md].
Accessing the Service¶
Once the service is running, you can verify its status using kubectl get services^[400-devops-06-kubernetes-minikube.md]. Accessing the service can be achieved through two primary methods^[400-devops-06-kubernetes-minikube.md]:
- Minikube URL: The command
minikube service [name]automatically launches a web browser and directs it to the service's URL^[400-devops-06-kubernetes-minikube.md]. - Port Forwarding: Alternatively, you can map a local port to the service's port using
kubectl port-forward^[400-devops-06-kubernetes-minikube.md]. For instance, forwarding7080:80makes the application available athttp://localhost:7080/^[400-devops-06-kubernetes-minikube.md].
Related Concepts¶
Sources¶
^[400-devops-06-kubernetes-minikube.md]