User Tools

Site Tools


devops:docker:kubernetes:tutorial-win-minikube

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devops:docker:kubernetes:tutorial-win-minikube [2024/06/19 19:56] skipidardevops:docker:kubernetes:tutorial-win-minikube [2024/07/24 20:22] (current) skipidar
Line 9: Line 9:
  
  
-== Use ==+== After restart - make sure its running == 
 +Make sure docker desktop is running after restart 
 + 
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/XlUG6VDonN.png}} 
 + 
 +== Use minikube ==
  
 <sxh> <sxh>
Line 16: Line 21:
  
 {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/aAf1dtbFrE.png}} {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/aAf1dtbFrE.png}}
 +
 +
 +
 +
 +
  
 <sxh> <sxh>
 kubectl get po -A kubectl get po -A
 </sxh> </sxh>
 +
 +== Prefix "minikube kubectl" ==
 +
 +To avoid "Unauthorized exception" when using "kubectl"
 +
 +it is important to use 
  
 <sxh> <sxh>
-minikube kubectl -- get po -A+minikube kubectl -- <YOU KUBECTL PARAMS> 
 +minikube kubectl -- version 
 +minikube kubectl -- create deployment demo-consume-api --image=ghcr.io/alfrepo/demo-consume-api:latest
 </sxh> </sxh>
  
 +== "alias" for kubectl ==
 +
 +Use the alias on Linux
 <sxh> <sxh>
 alias kubectl="minikube kubectl --" alias kubectl="minikube kubectl --"
 </sxh> </sxh>
 +
 +Use the functions on Windows powershell
 +<sxh>
 +function kubectl {
 +  param(
 +    [Parameter(Mandatory = $false)]
 +    [string] $arguments
 +  )
 +  minikube kubectl -- $arguments
 +}
 +</sxh>
 +
 +<sxh>
 +minikube kubectl -- get po -A
 +</sxh>
 +
 +
 +
 +
 +
 +== Dashboard == 
 +<sxh>
 +minikube dashboard
 +</sxh>
 +
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/FO4s2Vm4LF.png}}
 +{{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/G7y7VKDHkd.png}}
 +
 +
 +
 +== On Minikube - open a port to listen on your Windows machine == 
 +
 +Assume you earlier created some **deployment**
 +
 +<sxh shell>
 +minikube kubectl -- create deployment demo-consume-api --image=ghcr.io/alfrepo/demo-consume-api:latest
 +</sxh>
 +
 +This application is running on port ''8080'', exposing API on ''/public/hello''
 +
 +Then to expose the deployment
 +
 +<sxh shell>
 +minikube service list
 +|----------------------|---------------------------|--------------|-----|
 +|      NAMESPACE                 NAME            | TARGET PORT  | URL |
 +|----------------------|---------------------------|--------------|-----|
 +| default              | demo-consume-api          |         8080 |     |
 +| default              | kubernetes                | No node port |     |
 +| kube-system          | kube-dns                  | No node port |     |
 +| kubernetes-dashboard | dashboard-metrics-scraper | No node port |     |
 +| kubernetes-dashboard | kubernetes-dashboard      | No node port |     |
 +|----------------------|---------------------------|--------------|-----|
 +
 +
 +# pick the service deployment
 +# its on port 8080
 +# now make a port exposed
 +
 +minikube service --url demo-consume-api
 +http://127.0.0.1:52260
 +❗  Because you are using a Docker driver on windows, the terminal needs to be open to run it.
 +
 +# other terminal you now can
 +curl http://127.0.0.1:52260/public/hello
 +
 +</sxh>
 +
 +
  
devops/docker/kubernetes/tutorial-win-minikube.1718826975.txt.gz · Last modified: by skipidar