{"id":3887,"date":"2019-04-07T01:06:47","date_gmt":"2019-04-06T16:06:47","guid":{"rendered":"https:\/\/greentown.tokyo\/?p=3887"},"modified":"2019-04-07T01:06:47","modified_gmt":"2019-04-06T16:06:47","slug":"kubernetes-bootcamp","status":"publish","type":"post","link":"https:\/\/greentown.tokyo\/?p=3887","title":{"rendered":"kubernetes-bootcamp\u3092\u8a66\u3059"},"content":{"rendered":"<p>Kubernetes\uff08\u30af\u30fc\u30d0\u30cd\u30c6\u30a3\u30b9\uff09\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>Minikube\u3092\u4f7f\u3063\u305f\u30af\u30e9\u30b9\u30bf\u306e\u4f5c\u6210<\/h2>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/da5f8ede1e2c8c44018f5960715b6320.png\"><img decoding=\"async\" class=\"alignnone wp-image-3900 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/da5f8ede1e2c8c44018f5960715b6320-e1553254054578.png\" alt=\"\" width=\"1109\" height=\"808\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/da5f8ede1e2c8c44018f5960715b6320-e1553254054578.png 1109w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/da5f8ede1e2c8c44018f5960715b6320-e1553254054578-300x219.png 300w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/da5f8ede1e2c8c44018f5960715b6320-e1553254054578-768x560.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/da5f8ede1e2c8c44018f5960715b6320-e1553254054578-1024x746.png 1024w\" sizes=\"(max-width: 1109px) 100vw, 1109px\" \/><\/a><\/p>\n<h3>\u30af\u30e9\u30b9\u30bf\u306e\u5b9f\u884c<\/h3>\n<h6>minikube version<\/h6>\n<p>minikube \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3059\u308b<\/p>\n<p>&nbsp;<\/p>\n<h6>minikube start<\/h6>\n<p>\u30af\u30e9\u30b9\u30bf\u3092\u5b9f\u884c\u3059\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ minikube version\r\nminikube version: v0.34.1\r\n$\r\n$ minikube start\r\no   minikube v0.34.1 on linux (amd64)\r\n&gt;   Configuring local host environment ...\r\n&gt;   Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...\r\n-   \"minikube\" IP address is 172.17.0.75\r\n-   Configuring Docker as the container runtime ...\r\n-   Preparing Kubernetes environment ...\r\n@   Downloading kubelet v1.13.3\r\n@   Downloading kubeadm v1.13.3\r\n-   Pulling images required by Kubernetes v1.13.3 ...\r\n-   Launching Kubernetes v1.13.3 using kubeadm ...\r\n-   Configuring cluster permissions ...\r\n-   Verifying component health .....\r\n+   kubectl is now configured to use \"minikube\"\r\n=   Done! Thank you for using minikube!\r\n$<\/pre>\n<p>Minikube\u304cVM\u3092\u8d77\u52d5\u3057\u3001VM\u4e0a\u3067Kubernetes\u30af\u30e9\u30b9\u30bf\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>kubectl\u3092\u4f7f\u3063\u3066Kubernetes\u3068\u304a\u8a71\u3057\u3059\u308b<\/h3>\n<h6>kubeclt version<\/h6>\n<p>kubeclt \u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ kubeclt version\r\nkubeclt: command not found\r\n$ kubectl version\r\nClient Version: version.Info{Major:\"1\", Minor:\"13\", GitVersion:\"v1.13.3\", GitCommit:\"721bfa751924da8d1680787490c54b9179b1fed0\", GitTreeState:\"clean\", BuildDate:\"2019-02-01T20:08:12Z\", GoVersion:\"go1.11.5\", Compiler:\"gc\", Platform:\"linux\/amd64\"}\r\nServer Version: version.Info{Major:\"1\", Minor:\"13\", GitVersion:\"v1.13.3\", GitCommit:\"721bfa751924da8d1680787490c54b9179b1fed0\", GitTreeState:\"clean\", BuildDate:\"2019-02-01T20:00:57Z\", GoVersion:\"go1.11.5\", Compiler:\"gc\", Platform:\"linux\/amd64\"}\r\n$<\/pre>\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30de\u30b9\u30bf\u30fc\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u30b5\u30fc\u30d0\u30fc\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u8868\u793a\u3055\u308c\u308b\u3002<\/p>\n<p><span style=\"font-size: 120%;\"><strong><span style=\"color: #ff99cc;\">\u30de\u30b9\u30bf\u30fc\u306f\u30af\u30e9\u30b9\u30bf\u306e\u7ba1\u7406\u3092\u3059\u308b\u4eba<\/span><\/strong><\/span><\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/e08c24334a4a4e706c917aecd4457392.png\"><img decoding=\"async\" class=\"alignnone wp-image-3896 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/e08c24334a4a4e706c917aecd4457392.png\" alt=\"\" width=\"1182\" height=\"830\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/e08c24334a4a4e706c917aecd4457392.png 1182w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/e08c24334a4a4e706c917aecd4457392-300x211.png 300w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/e08c24334a4a4e706c917aecd4457392-768x539.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/e08c24334a4a4e706c917aecd4457392-1024x719.png 1024w\" sizes=\"(max-width: 1182px) 100vw, 1182px\" \/><\/a><\/p>\n<h6><\/h6>\n<h6>kubectl cluster-info<\/h6>\n<p>\u30af\u30e9\u30b9\u30bf\u306e\u8a73\u7d30\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ kubectl cluster-info\r\nKubernetes master is running at https:\/\/172.17.0.75:8443\r\nKubeDNS is running at https:\/\/172.17.0.75:8443\/api\/v1\/namespaces\/kube-system\/services\/kube-dns:dns\/proxy\r\n\r\nTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.\r\n$<\/pre>\n<p>\u5b9f\u884c\u4e2d\u306e\u30de\u30b9\u30bf\u30fc\u3092\u78ba\u8a8d\u3002<\/p>\n<p>Kubernetes\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3067\u3001\u30de\u30a4\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u898b\u308c\u308b\u30fb\u30fb\u3089\u3057\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6><span class=\"Apple-converted-space\">\u00a0<\/span>kubectl get nodes<\/h6>\n<p>\u30af\u30e9\u30b9\u30bf\u5185\u306e\u30ce\u30fc\u30c9\u3092\u8868\u793a\u3059\u308b\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ kubectl get nodes\r\nNAME       STATUS   ROLES    AGE   VERSION\r\nminikube   Ready    master   46m   v1.13.3\r\n$<\/pre>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30db\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b\u3059\u3079\u3066\u306e\u30ce\u30fc\u30c9\u3092\u8868\u793a\u3002\u2191\u306f\u3072\u3068\u3064\u3060\u3051\u3067\u3059\u306d\u3002\uff08\u307b\u3093\u3068\u306f\u3001\u6700\u4f4e\u3067\u3082\uff13\u3064\u3044\u308b\u3089\u3057\u3044\uff09<\/p>\n<p>Ready\u3063\u3066\u306a\u3063\u3066\u308b\u306e\u306f\uff64\u30a2\u30d7\u30ea\u306e\u30c7\u30d7\u30ed\u30a4\u6e96\u5099\u304a\u3063\u3051\u3043&#x1f44c;&#x1f970;\u3063\u3066\u3053\u3068\u3002<\/p>\n<p><span style=\"font-size: 120%;\"><strong><span style=\"color: #ff99cc;\">Node\u306f\u5b9f\u884c\u4e2d\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30db\u30b9\u30c8\u3059\u308b\u4eba<\/span><\/strong><\/span><\/p>\n<p>Node\u306f\u3001Kubernetes\u30af\u30e9\u30b9\u30bf\u306e\u30ef\u30fc\u30ab\u30fc\u30de\u30b7\u30f3\u3068\u3057\u3066\u6a5f\u80fd\u3059\u308bVM\u307e\u305f\u306f\u7269\u7406\u30de\u30b7\u30f3\u3002<\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/1636f59d8b0262f7d80b9d50bf3dfb28.png\"><img decoding=\"async\" class=\"alignnone wp-image-3903 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/1636f59d8b0262f7d80b9d50bf3dfb28-e1553254326399.png\" alt=\"\" width=\"154\" height=\"166\" \/><\/a><\/p>\n<h6>kubelet<\/h6>\n<p>Node\u3092\u7ba1\u7406\u3057\u30de\u30b9\u30bf\u30fc\u3068\u901a\u4fe1\u3059\u308b\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3002Docker\u3084rkt\u306e\u64cd\u4f5c\u3082\u3059\u308b\u3089\u3057\u3043\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>rkt\u3063\u3066\u306a\u3093\u305e\u3084\uff1f<\/h6>\n<p>pod\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u30b3\u30f3\u30c6\u30ca\u30a8\u30f3\u30b8\u30f3\uff08Linux\u5165\u9580\u3088\u308a\uff09\u3002\u3053\u308c\u4ee5\u4e0a\u8abf\u3079\u308b\u3068\u6df1\u307f\u306b\u30cf\u30de\u308a\u305d\u3046\u306a\u306e\u3067\u3001\u3053\u308c\u304f\u3089\u3044\u306b\u3057\u3066\u304a\u304f\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d7\u30ed\u30a4<\/h2>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/5045f3c2d1b738015caa42e1ab02e143.png\"><img decoding=\"async\" class=\"alignnone wp-image-3906 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/5045f3c2d1b738015caa42e1ab02e143.png\" alt=\"\" width=\"1204\" height=\"630\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/5045f3c2d1b738015caa42e1ab02e143.png 1204w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/5045f3c2d1b738015caa42e1ab02e143-300x157.png 300w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/5045f3c2d1b738015caa42e1ab02e143-768x402.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/5045f3c2d1b738015caa42e1ab02e143-1024x536.png 1024w\" sizes=\"(max-width: 1204px) 100vw, 1204px\" \/><\/a><\/p>\n<h3>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u914d\u7f6e\u3059\u308b<\/h3>\n<p>kubectl \u3092\u4f7f\u3063\u3066Deployment \u306e\u4f5c\u6210\u3068\u7ba1\u7406\u3092\u884c\u3046\u3002<\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/38342f7b46e2f989fb348c73001fe91c.png\"><img decoding=\"async\" class=\"alignnone wp-image-3909 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/38342f7b46e2f989fb348c73001fe91c.png\" alt=\"\" width=\"1108\" height=\"710\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/38342f7b46e2f989fb348c73001fe91c.png 1108w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/38342f7b46e2f989fb348c73001fe91c-300x192.png 300w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/38342f7b46e2f989fb348c73001fe91c-768x492.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/38342f7b46e2f989fb348c73001fe91c-1024x656.png 1024w\" sizes=\"(max-width: 1108px) 100vw, 1108px\" \/><\/a><\/p>\n<p>Deployment\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u30af\u30e9\u30b9\u30bf\u4e0a\u306b\u30b3\u30f3\u30c6\u30ca\u5316\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c7\u30d7\u30ed\u30a4\u3067\u304d\u308b\u3002<\/p>\n<p>kubectl \u306f API \u3092\u4f7f\u3063\u3066\u30af\u30e9\u30b9\u30bf\u3068\u5bfe\u8a71\u3059\u308b\u3002<\/p>\n<h6>kubectl run<\/h6>\n<ul>\n<li>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u5b9f\u884c\u3067\u304d\u308bNode\u3092\u691c\u7d22\u3059\u308b<\/li>\n<li>\u305d\u306eNode\u3067\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3059\u308b<\/li>\n<li>\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u65b0\u3057\u3044Node\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u518d\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3059\u308b\u3088\u3046\u306b\u30af\u30e9\u30b9\u30bf\u3092\u8a2d\u5b9a\u3059\u308b<\/li>\n<\/ul>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ kubectl run kubernetes-bootcamp --image=gcr.io\/google-samples\/kubernetes-bootcamp:v1--port=8080\r\nkubectl run --generator=deployment\/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod\/v1 or kubectl create instead.\r\ndeployment.apps\/kubernetes-bootcamp created\r\n$<\/pre>\n<p>kubectl run &#8211;generator=deployment\/apps.v1<\/p>\n<p>\u2191\u3053\u308c\u306f\u5ec3\u6b62\u306b\u306a\u3063\u3061\u3083\u3046\u304b\u3089\u3001\u4eca\u5ea6\u304b\u3089<\/p>\n<p>kubectl run &#8211;generator=run-pod\/v1 \u304b kubectl create \u3092\u4f7f\u3063\u3066\u306d\u3002\u3060\u3063\u3066\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>kubectl get deployments<\/h6>\n<p>deployments\u3092\u8868\u793a\u3059\u308b\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ kubectl get deployments\r\nNAME                  READY   UP-TO-DATE   AVAILABLE   AGE\r\nkubernetes-bootcamp   1\/1     1            1           9m58s\r\n$<\/pre>\n<p>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306f\u3001Node\u4e0a\u306eDocker\u30b3\u30f3\u30c6\u30ca\u5185\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>Deployment\u306f\u30a2\u30d7\u30ea\u30b1\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u3001\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\u3092\u63d0\u4f9b\u3059\u308b\u3002Deployment\u3092\u4f5c\u6210\u3059\u308b\u3068\u30de\u30b9\u30bf\u30fc\u306f\u6307\u5b9a\u3055\u308c\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30af\u30e9\u30b9\u30bf\u5185\u306e\u500b\u3005\u306eNode\u306b\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u308b\u3068Deployment\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u7d99\u7d9a\u7684\u306b\u76e3\u8996\u3059\u308b\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u30db\u30b9\u30c8\u3057\u3066\u3044\u308bNode\u304c\u505c\u6b62\u30fb\u524a\u9664\u3055\u308c\u305f\u5834\u5408\u3001Deployment\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u7f6e\u304d\u63db\u3048\u3092\u884c\u3046\uff08<span style=\"color: #ff99cc;\"><b>\u30bb\u30eb\u30d5\u30d2\u30fc\u30ea\u30f3\u30b0<\/b><\/span>\uff09<\/p>\n<p>&nbsp;<\/p>\n<h3>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u898b\u3066\u307f\u3088\u3046<\/h3>\n<p>\u30dd\u30c3\u30c9\u306f\u9694\u96e2\u3055\u308c\u305f\u30d6\u30e9\u30a4\u30d9\u30fc\u30c8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5185\u3067\u5b9f\u884c\u3055\u308c\u3001\u30af\u30e9\u30b9\u30bf\u5185\u306e\u4ed6\u306e\u30dd\u30c3\u30c9\u3084\u30b5\u30fc\u30d3\u30b9\u304b\u3089\u306f\u898b\u3048\u308b\u304c\u901a\u4fe1\u306f\u3067\u304d\u306a\u3044\u3002<\/p>\n<p>kubectl \u3092\u4f7f\u7528\u3059\u308b\u3068\u3001API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4ecb\u3057\u5bfe\u8a71\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u901a\u4fe1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>kubectl proxy<\/h6>\n<p>\u30af\u30e9\u30b9\u30bf\u5168\u4f53\u306e\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u901a\u4fe1\u3092\u8ee2\u9001\u3059\u308b\u30d7\u30ed\u30ad\u30b7\u3092\u4f5c\u6210\u3059\u308b\u3002\u30d7\u30ed\u30ad\u30b7\u3092\u7d42\u4e86\u3059\u308b\u306b\u306fCtrl + C\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ kubectl proxy\r\nStarting to serve on 127.0.0.1:8001\r\n$<\/pre>\n<p>\u30db\u30b9\u30c8\u3068\u30af\u30e9\u30b9\u30bf\u306e\u63a5\u7d9a\u78ba\u7acb\u304a\u3063\u3051\u3043\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>API\u3092\u901a\u3058\u3066\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u554f\u3044\u5408\u308f\u305b\u3066\u307f\u308b\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ curl http:\/\/localhost:8001\/version\r\n{\r\n  \"major\": \"1\",\r\n  \"minor\": \"13\",\r\n  \"gitVersion\": \"v1.13.3\",\r\n  \"gitCommit\": \"721bfa751924da8d1680787490c54b9179b1fed0\",\r\n  \"gitTreeState\": \"clean\",\r\n  \"buildDate\": \"2019-02-01T20:00:57Z\",\r\n  \"goVersion\": \"go1.11.5\",\r\n  \"compiler\": \"gc\",\r\n  \"platform\": \"linux\/amd64\"\r\n}$<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30dd\u30c3\u30c8\u540d\u3092\u53d6\u5f97\u3057\u3066\u74b0\u5883\u5909\u6570\u306b\u5165\u308c\u308b\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ export POD_NAME=$(kubectl get pods -o go-template --template '{{range.items}}{{.metadata.name}}{{\"\u00a5n\"}}{{end}}')\r\n$ echo Name of the Pod: $POD_NAME\r\nName of the Pod: kubernete4sbootcamp-c96bdb4b4-zrm7j\u00a5n\r\n$<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30dd\u30c3\u30c9\u540d\u3092\u6307\u5b9a\u3057\u3066\u305d\u306e\u30dd\u30c3\u30c9\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306bHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3002\u3060\u3093\u3060\u3093\u3001\u7406\u89e3\u304c\u8ffd\u3044\u3064\u3044\u3066\u3053\u306a\u304f\u306a\u308b\u306e\u5dfb\u30fb\u30fb<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ curl http:\/\/localhost:8001\/api\/v1\/namespaces\/default\/pods\/$POD_NAME\/proxy\/\r\n{\r\n  \"kind\": \"Status\",\r\n  \"apiVersion\": \"v1\",\r\n  \"metadata\": {\r\n\r\n  },\r\n  \"status\": \"Failure\",\r\n  \"message\": \"pods \\\"kubernete4sbootcamp-c96bdb4b4-zrm7j\u00a5n\\\" not found\",\r\n  \"reason\": \"NotFound\",\r\n  \"details\": {\r\n    \"name\": \"kubernete4sbootcamp-c96bdb4b4-zrm7j\u00a5n\",\r\n    \"kind\": \"pods\"\r\n  },\r\n  \"code\": 404\r\n}$<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u63a2\u7d22<\/h2>\n<h3>Kubernetes Pod<\/h3>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u30db\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3002\u3072\u3068\u3064\u4ee5\u4e0a\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30f3\u30c6\u30ca\u306e\u30b0\u30eb\u30fc\u30d7\u3068\u5171\u6709\u30ea\u30bd\u30fc\u30b9\u3092\u8868\u3059\u62bd\u8c61\u6982\u5ff5\u3002<\/p>\n<ul>\n<li>\u5171\u6709\u30b9\u30c8\u30ec\u30fc\u30b8\uff08\u30dc\u30ea\u30e5\u30fc\u30e0\uff09<\/li>\n<li>\u30cd\u30c3\u30c8\u30ef\u30fc\u30ad\u30f3\u30b0\uff08\u30af\u30e9\u30b9\u30bf\u306b\u56fa\u6709\u306eIP\u30a2\u30c9\u30ec\u30b9\uff09<\/li>\n<li>\u30b3\u30f3\u30c6\u30ca\u306e\u30a4\u30e1\u30fc\u30b8\u30d0\u30fc\u30b8\u30e7\u30f3\u3084\u4f7f\u7528\u3059\u308b\u30dd\u30fc\u30c8\u306a\u306ed\u306e\u5404\u30b3\u30f3\u30c6\u30ca\u3092\u3069\u3046\u52d5\u304b\u3059\u304b\u306b\u95a2\u3059\u308b\u60c5\u5831<\/li>\n<\/ul>\n<p>\u3068\u304b\u3092\u542b\u3080\u3002<\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/bd9c62c857b6a42b0c94688df7dc0489.png\"><img decoding=\"async\" class=\"alignnone wp-image-3914 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/bd9c62c857b6a42b0c94688df7dc0489.png\" alt=\"\" width=\"1252\" height=\"464\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/bd9c62c857b6a42b0c94688df7dc0489.png 1252w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/bd9c62c857b6a42b0c94688df7dc0489-300x111.png 300w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/bd9c62c857b6a42b0c94688df7dc0489-768x285.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/bd9c62c857b6a42b0c94688df7dc0489-1024x380.png 1024w\" sizes=\"(max-width: 1252px) 100vw, 1252px\" \/><\/a><\/p>\n<p>Deployment\u304c\u30b3\u30f3\u30c6\u30ca\u3092\u6301\u3064Pod\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<p>Pod\u306b\u306f\u3001\u4f8b\u3048\u3070Node.js\u30a2\u30d7\u30ea\u306e\u30b3\u30f3\u30c6\u30ca\u3001Node.js Web\u30b5\u30fc\u30d0\u30fc\u306b\u3088\u3063\u3066\u30c7\u30fc\u30bf\u4f9b\u7d66\u3055\u308c\u308b\u30b3\u30f3\u30c6\u30ca\u3001\u306a\u3069\u3092\u542b\u3080\u3053\u3068\u304c\u3067\u304d\u308b\u3002Pod\u5185\u306e\u5404\u30b3\u30f3\u30c6\u30ca\u306f\u3001IP\u30a2\u30c9\u30ec\u30b9\u3001\u30dd\u30fc\u30c8\u3092\u5171\u6709\u3057\u540c\u3058\u5834\u6240\u306b\u914d\u7f6e\u30fb\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3055\u308c\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>Node<\/h3>\n<p>Node\u306f\u8907\u6570\u306ePod\u3092\u6301\u3064\u3053\u3068\u304c\u3067\u304d\u3001\u30de\u30b9\u30bf\u30fc\u306b\u7ba1\u7406\u3055\u308c\u308b\u3002\u30de\u30b9\u30bf\u30fc\u306f\u30af\u30e9\u30b9\u30bf\u5185\u306eNode\u9593\u3067Pod\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u81ea\u52d5\u7684\u306b\u30b9\u30b1\u30b8\u30e5\u30fc\u30ea\u30f3\u30b0\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/22596e460f99cd32519db92016757f1e.png\"><img decoding=\"async\" class=\"alignnone wp-image-3915 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/22596e460f99cd32519db92016757f1e.png\" alt=\"\" width=\"1242\" height=\"910\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/22596e460f99cd32519db92016757f1e.png 1242w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/22596e460f99cd32519db92016757f1e-300x220.png 300w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/22596e460f99cd32519db92016757f1e-768x563.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/03\/22596e460f99cd32519db92016757f1e-1024x750.png 1024w\" sizes=\"(max-width: 1242px) 100vw, 1242px\" \/><\/a><\/p>\n<h6>kubelet<\/h6>\n<ul>\n<li>\u30de\u30b9\u30bf\u30fc\u3068Node\u9593\u306e\u901a\u4fe1\u3092\u62c5\u5f53\u3059\u308b<\/li>\n<li>Pod\u3068\u30b3\u30f3\u30c6\u30ca\u3092\u7ba1\u7406\u3059\u308b<\/li>\n<\/ul>\n<p>Node\u306f\u3001\u30ec\u30b8\u30b9\u30c8\u30ea\uff1f\u304b\u3089\u30b3\u30f3\u30c6\u30ca\u30a4\u30e1\u30fc\u30b8\u3092\u53d6\u5f97\u3001\u89e3\u51cd\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u3002Docker\u3001rkt\u307f\u305f\u3044\u306a\u30e9\u30f3\u30bf\u30a4\u30e0\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>kubectl<\/h3>\n<p>\u30c7\u30d7\u30ed\u30a4\u3055\u308c\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u305d\u306e\u74b0\u5883\u306b\u95a2\u3059\u308b\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>kubectl get pods<\/h6>\n<p>Pod\u306e\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"> kubectl get pods\r\nNAME                                   READY   STATUS    RESTARTS   AGE\r\nkubernetes-bootcamp-6bf84cb898-84dsr   1\/1     Running   0          13s<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h6>kubectl describe pods<\/h6>\n<p>Pod\u5185\u306e\u30b3\u30f3\u30c6\u30ca\u60c5\u5831\u3092\u8868\u793a\u3002IP\u30a2\u30c9\u30ec\u30b9\u3084\u30dd\u30fc\u30c8\u756a\u53f7\u3001Pod\u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306a\u3069\u304c\u8868\u793a\u3055\u308c\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ kubectl describe pods\r\nName:               kubernetes-bootcamp-6bf84cb898-84dsr\r\nNamespace:          default\r\nPriority:           0\r\nPriorityClassName:  &lt;none&gt;\r\nNode:               minikube\/172.17.0.65\r\nStart Time:         Sat, 06 Apr 2019 11:09:53 +0000\r\nLabels:             pod-template-hash=6bf84cb898\r\n                    run=kubernetes-bootcamp\r\nAnnotations:        &lt;none&gt;\r\nStatus:             Running\r\nIP:                 172.18.0.2\r\n\uff1a\r\n\uff1a\r\n\uff08\u306a\u3093\u304b\u3001\u3044\u3063\u3071\u3044\u8868\u793a\u3055\u308c\u308b\uff09<\/pre>\n<p>&nbsp;<\/p>\n<p>\u3053\u308c\u3001\u3055\u3063\u304d\u3084\u3063\u305f\u3084\u3064\uff08\u30af\u30e9\u30b9\u30bf\u5168\u4f53\u306e\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u901a\u4fe1\u3092\u8ee2\u9001\u3059\u308b\u30d7\u30ed\u30ad\u30b7\u3092\u4f5c\u6210\uff09<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ kubectl proxy\r\nStarting to serve on 127.0.0.1:8001<\/pre>\n<p>\uff08\u30dd\u30c3\u30c8\u540d\u3092\u53d6\u5f97\u3057\u3066\u74b0\u5883\u5909\u6570\u306b\u5165\u308c\u308b\uff09<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{\"\\n\"}}{{end}}')\r\n$ echo Name of the Pod: $POD_NAME\r\nName of the Pod: kubernetes-bootcamp-6bf84cb898-8zs8t<\/pre>\n<p>\uff08\u30dd\u30c3\u30c9\u540d\u3092\u6307\u5b9a\u3057\u3066\u305d\u306e\u30dd\u30c3\u30c9\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306bHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\uff09<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h6>kubectl logs<\/h6>\n<p>\u4e0a\u30b3\u30f3\u30c6\u30ca\u5185\u306e\u30ed\u30b0\u3092\u8868\u793a\u3059\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ kubectl logs $POD_NAME\r\nKubernetes Bootcamp App Started At: 2019-04-06T14:33:24.185Z | Running On:  kubernetes-bootcamp-6bf84cb898-8zs8t\r\n\r\nRunning On: kubernetes-bootcamp-6bf84cb898-8zs8t | Total Requests: 1 | App Uptime: 275.768 seconds | Log Time: 2019-04-06T14:37:59.953Z<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h6>kubectl exec<\/h6>\n<p>Pod\u4e0a\u30b3\u30f3\u30c6\u30ca\u3067\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ kubectl exec $POD_NAME env\r\nPATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\r\nHOSTNAME=kubernetes-bootcamp-6bf84cb898-8zs8t\r\nKUBERNETES_PORT_443_TCP_PROTO=tcp\r\nKUBERNETES_PORT_443_TCP_PORT=443\r\nKUBERNETES_PORT_443_TCP_ADDR=10.96.0.1\r\nKUBERNETES_SERVICE_HOST=10.96.0.1\r\nKUBERNETES_SERVICE_PORT=443\r\nKUBERNETES_SERVICE_PORT_HTTPS=443\r\nKUBERNETES_PORT=tcp:\/\/10.96.0.1:443\r\nKUBERNETES_PORT_443_TCP=tcp:\/\/10.96.0.1:443\r\nNPM_CONFIG_LOGLEVEL=info\r\nNODE_VERSION=6.3.1\r\nHOME=\/root\r\n$<\/pre>\n<p>&nbsp;<\/p>\n<h6>kubectl exec -ti $POD_NAME bash<\/h6>\n<p>\u30b3\u30f3\u30c6\u30ca\u306b\u5165\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ kubectl exec -ti $POD_NAME bash\r\nroot@kubernetes-bootcamp-6bf84cb898-8zs8t:\/#<\/pre>\n<p>&nbsp;<\/p>\n<p>NodeJS\u304c\u52d5\u3044\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># curl localhost:8080\r\nHello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-6bf84cb898-8zs8t | v=1<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u7d9a\u304d\u306f\u6b21\u56de\u301c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes\uff08\u30af\u30fc\u30d0\u30cd\u30c6\u30a3\u30b9\uff09\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002 Minikube\u3092\u4f7f\u3063\u305f\u30af\u30e9\u30b9\u30bf\u306e\u4f5c\u6210 \u30af\u30e9\u30b9\u30bf\u306e\u5b9f\u884c minikube version minikube \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3981,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98],"tags":[],"class_list":["post-3887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-container"],"_links":{"self":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3887"}],"collection":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3887"}],"version-history":[{"count":25,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3887\/revisions"}],"predecessor-version":[{"id":3982,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3887\/revisions\/3982"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/media\/3981"}],"wp:attachment":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}