|
| 1 | + |
| 2 | +### Installing MiniKube |
| 3 | + |
| 4 | +TODO |
| 5 | + |
| 6 | +### Using MiniKube |
| 7 | + |
| 8 | +Start Minikube |
| 9 | + |
| 10 | + minikube start |
| 11 | + Starting local Kubernetes v1.7.5 cluster... |
| 12 | + Starting VM... |
| 13 | + Getting VM IP address... |
| 14 | + Moving files into cluster... |
| 15 | + Setting up certs... |
| 16 | + Connecting to cluster... |
| 17 | + Setting up kubeconfig... |
| 18 | + Starting cluster components... |
| 19 | + Kubectl is now configured to use the cluster. |
| 20 | + |
| 21 | +Check status |
| 22 | + |
| 23 | + kubectl get nodes |
| 24 | + NAME STATUS ROLES AGE VERSION |
| 25 | + minikube Ready <none> 6m v1.7.5 |
| 26 | + |
| 27 | +If opening another terminal windows, point Docker and Kubectl to |
| 28 | +Minikube |
| 29 | + |
| 30 | + eval $(minikube docker-env) |
| 31 | + |
| 32 | +### Accessing services in Minikube |
| 33 | + |
| 34 | +Switching the nginx service from `LoadBalancer` to `NodePort`: |
| 35 | + |
| 36 | + └─[$]> kubectl get services |
| 37 | + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 38 | + kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 1d |
| 39 | + nginx LoadBalancer 10.0.0.34 <pending> 80:32352/TCP 1d |
| 40 | + php-fpm ClusterIP 10.0.0.93 <none> 9000/TCP 1d |
| 41 | + |
| 42 | + # Change spec.type to NodePort |
| 43 | + └─[$]> kubectl edit service nginx |
| 44 | + service "nginx" edited |
| 45 | + |
| 46 | + └─[$]> kubectl get services |
| 47 | + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 48 | + kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 1d |
| 49 | + nginx NodePort 10.0.0.34 <none> 80:32352/TCP 1d |
| 50 | + php-fpm ClusterIP 10.0.0.93 <none> 9000/TCP 1d |
| 51 | + |
| 52 | + └─[$]> minikube service nginx |
| 53 | + Opening kubernetes service default/nginx in default browser... |
| 54 | + |
| 55 | + └─[$]> minikube service nginx --url |
| 56 | + http://192.168.99.100:32352 |
| 57 | + |
| 58 | +### MiniKube load balancer and nodeports |
| 59 | + |
| 60 | + |
| 61 | +https://github.com/kubernetes/minikube/issues/950 |
| 62 | + |
| 63 | +> Currently minikube doesn't support LoadBalancer, it doesn't assign to |
| 64 | + it external IP. And services are supposed to access using minikube |
| 65 | + service service-name... is uses port mapping and it is quite cumbersome |
| 66 | + (esp if service exposes more then one port) |
| 67 | + |
| 68 | +https://github.com/kubernetes/minikube/issues/38 |
| 69 | + |
| 70 | +Referenced by #950, #950 marked as a dupe of #38. |
| 71 | + |
| 72 | +https://medium.com/@claudiopro/getting-started-with-kubernetes-via-minikube-ada8c7a29620 |
| 73 | + |
| 74 | +> Note we must use the type=NodePort because minikube doesn’t support the LoadBalancer service. |
| 75 | +
|
| 76 | + $ kubectl expose deployment hello-node --type=NodePort |
| 77 | + $ kubectl get services |
| 78 | + $ curl $(minikube service hello-node --url) |
| 79 | + |
| 80 | +https://github.com/kubernetes/minikube/issues/384 |
| 81 | + |
| 82 | +> LoadBalancer services run fine on minikube, just with no real external |
| 83 | + load balancer created. LoadBalancer services get a node port assigned |
| 84 | + too so you can access services via `minikube service <name>` to open |
| 85 | + browser or add `--url` flag to output service URL to terminal. |
| 86 | + Would that cover what you need or is there something more that you'd |
| 87 | + like to see? |
0 commit comments