{"id":281,"date":"2020-05-21T12:31:23","date_gmt":"2020-05-21T04:31:23","guid":{"rendered":"https:\/\/www.funnymuddy.com\/?p=281"},"modified":"2020-05-30T22:38:58","modified_gmt":"2020-05-30T14:38:58","slug":"minikube","status":"publish","type":"post","link":"https:\/\/www.funnymuddy.com\/?p=281","title":{"rendered":"minikube"},"content":{"rendered":"\n<p><a href=\"https:\/\/minikube.sigs.k8s.io\/docs\/start\/\">\u5b98\u65b9\u6587\u6863<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/minikube.sigs.k8s.io\/docs\/handbook\/\">Handbook<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">minikube single-node cluster<\/h2>\n\n\n\n<p>curl -LO https:\/\/storage.googleapis.com\/minikube\/releases\/latest\/minikube-darwin-amd64<br>sudo install minikube-darwin-amd64 \/usr\/local\/bin\/minikube<br>minikube start &#8211;driver=virtualbox #have many other options like docker\/podman<br>kubectl get nodes<br>minikube status<code><br><\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">minikube multi-node cluster<\/h2>\n\n\n\n<p>\u65b0\u7248\u672c\u7684minikube<a href=\"https:\/\/minikube.sigs.k8s.io\/docs\/tutorials\/multi_node\/\">\u5f00\u59cb\u5c1d\u8bd5\u652f\u6301multiple-node cluster<\/a><\/p>\n\n\n\n<p><code>$minikube start --nodes 2 -p cluster --driver=virtualbox #cluster is the name of the cluster you're creating<br>More options: --memory='8g' (per vm, default is 2g) --cpus=4 (per vm, default is 2)<br>$kubectl get nodes<br>$minikube status -p cluster<br>$minikube dashboard -p cluster #create a dashboard<br>$minikube stop -p cluster<br>$minikube delete -p cluster<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">create a service (2 instances)<\/h2>\n\n\n\n<p><a href=\"https:\/\/minikube.sigs.k8s.io\/docs\/tutorials\/multi_node\/\">See official site<\/a>.<br>$vi hello-deployment.yml<br>$vi hello-svc.yml<br>$kubectl apply -f hello-deploy.yml<br>$kubectl apply -f hello-svc.yml<br>$kubectl get pods -o wide<br>$kubectl get pod -w -l app=nginx<br>$minikube service list -p cluster<br>$minikube service service_name &#8211;url<br>$kubectl get service service_name<br>$curl&nbsp; http:\/\/192.168.99.104:31000 #run many times to see which pod a response is from<br>$kubectl get pods<br><br>$kubectl logs -f pod_name<br>$kubectl exec -it pod_name &#8212; \/bin\/bash<br>$kubectl get pod pod_name -o yams<br>$kubectl get events<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">minikube add-ons<\/h2>\n\n\n\n<p>$minikube addons list -p cluster<br>$minikube addons enable &lt;name&gt; -p cluster<br>$minikube addons open &lt;name&gt; -p cluster #expose a browser endpoint<br>$minikube addons disable &lt;name&gt; -p cluster #disable add-on<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5176\u4ed6\u5e38\u7528<\/h2>\n\n\n\n<p>Use&nbsp;<a href=\"https:\/\/kubernetes.io\/docs\/reference\/generated\/kubectl\/kubectl-commands\/#run\"><code>kubectl run<\/code><\/a>&nbsp;to execute a container that provides the&nbsp;<code>nslookup<\/code>&nbsp;command from the&nbsp;<code>dnsutils<\/code>&nbsp;package. Using&nbsp;<code>nslookup<\/code>&nbsp;on the Pods\u2019 hostnames, you can examine their in-cluster DNS addresses.<\/p>\n\n\n\n<p>$kubectl run -i &#8211;tty &#8211;image busybox:1.28 dns-test &#8211;restart=Never &#8211;rm<br>$nslookup web-0.nginx<\/p>\n\n\n\n<p>$kubectl get statefulset web<\/p>\n\n\n\n<p><\/p>\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_281\" class=\"pvc_stats all  \" data-element-id=\"281\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" src=\"https:\/\/www.funnymuddy.com\/wp-content\/plugins\/page-views-count\/ajax-loader.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>\u5b98\u65b9\u6587\u6863 Handbook minikube single-node cluster curl -LO htt&hellip;&nbsp;<a href=\"https:\/\/www.funnymuddy.com\/?p=281\" class=\"\" rel=\"bookmark\">\u9605\u8bfb\u66f4\u591a &raquo;<span class=\"screen-reader-text\">minikube<\/span><\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_281\" class=\"pvc_stats all  \" data-element-id=\"281\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" src=\"https:\/\/www.funnymuddy.com\/wp-content\/plugins\/page-views-count\/ajax-loader.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[20],"class_list":["post-281","post","type-post","status-publish","format-standard","hentry","category-6","tag-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=\/wp\/v2\/posts\/281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=281"}],"version-history":[{"count":25,"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions"}],"predecessor-version":[{"id":497,"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions\/497"}],"wp:attachment":[{"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.funnymuddy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}