Deploy Your Programs in Minikube with Docker and Helm
Minikube is the perfect tool for learning how to make deployments in Kubernetes. All you need is a Docker (or similar) container or Virtual Machine environment, and you can have Kubernetes up and running with a single command: minikube start.
Docker daemon in minikube doesn’t know about the Docker daemon on the Windows/Linux/macOS host. But there’s a simple solution for that - we can share the context using this command:
& minikube -p minikube docker-env --shell powershell | Invoke-ExpressionNext, build your image:
docker build -t example-netcore-k8s .In order to create a k8s deployment, we need a yaml file which specifies what should be deployed in minikube.
Now let's create the deployment using kubectl:
kubectl create -f deployment.yamlCheck if the deployment has suceeded:
kubectl get deploymentsCheck the pods:
kubectl get podsIn k8s and minikube as well, you must create a service to expose the application to a public IP/Port. If you're running your application in a managed k8s environment at your cloud provider of choice, the type of the service to expose your application is likely to be a LoadBalancer. When using minikube, the only service type available is nodePort.
The command to expose your application using a nodePort, is this:
kubectl expose deployment example-netcore-k8s --type=NodePortTo find at which IP and Port the application is exposed in minikube you must use this command:
minikube service example-netcore-k8s --url

Reacties
Een reactie posten