{"id":1937,"date":"2023-09-26T09:22:41","date_gmt":"2023-09-26T00:22:41","guid":{"rendered":"https:\/\/www.kwonline.org\/memo2\/?p=1937"},"modified":"2025-10-15T16:55:05","modified_gmt":"2025-10-15T07:55:05","slug":"use-kubectl-on-aws-eks","status":"publish","type":"post","link":"https:\/\/www.kwonline.org\/memo2\/2023\/09\/26\/use-kubectl-on-aws-eks\/","title":{"rendered":"AWS EKS \u3067 kubectl \u3092\u4f7f\u3046"},"content":{"rendered":"<p>&nbsp;<br \/>\n\u65b0\u3057\u3044\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u4f5c\u3063\u305f\u6642\u306b\u5fc5\u8981\u306a\u306e\u3067\u30e1\u30e2\u3002<\/p>\n<p>kubectl \u3092\u5f53\u7136\u5148\u306b\u5165\u308c\u3066\u304a\u304f\u3002\u4eca\u56de\u306f\u30d0\u30fc\u30b8\u30e7\u30f3\u6307\u5b9a\u3067 1.26.9 \u3092\u4f7f\u3046\u3002<br \/>\n\u305d\u306e\u4ed6\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f <a href=\"https:\/\/kubernetes.io\/releases\/\" rel=\"noopener\" target=\"_blank\">\u30ea\u30ea\u30fc\u30b9\u30ce\u30fc\u30c8<\/a> \u3067\u78ba\u8a8d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncurl -LO https:\/\/dl.k8s.io\/release\/v1.26.9\/bin\/linux\/amd64\/kubectl\r\nchmod +x kubectl\r\nsudo mv kubectl \/usr\/local\/bin\/\r\n<\/pre>\n<h3>eksctl<\/h3>\n<p>eksctl \u3082\u4f7f\u3046\u306e\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3068\u304f\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nARCH=amd64\r\nPLATFORM=$(uname -s)_$ARCH\r\ncurl -sLO &quot;https:\/\/github.com\/eksctl-io\/eksctl\/releases\/latest\/download\/eksctl_$PLATFORM.tar.gz&quot;\r\ntar -xzf eksctl_$PLATFORM.tar.gz -C \/tmp &amp;&amp; rm eksctl_$PLATFORM.tar.gz\r\nsudo mv \/tmp\/eksctl \/usr\/local\/bin\r\n<\/pre>\n<h3>eksctl \u3067 EKS cluster + node group \u3092\u4f5c\u308b<\/h3>\n<p>yaml \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066\u3001 eksctl \u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u6210<\/p>\n<pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\r\napiVersion: eksctl.io\/v1alpha5\r\nkind: ClusterConfig\r\n\r\nmetadata:\r\n  name: oreno-eks-001\r\n  region: ap-northeast-1\r\n  version: &quot;1.26&quot;\r\n\r\nvpc:\r\n  subnets:\r\n    public:\r\n      ap-northeast-1a: { id: subnet-1234 }\r\n      ap-northeast-1c: { id: subnet-5678 }\r\n\r\nnodeGroups:\r\n  - name: oreno-ng-001\r\n    instanceType: t3.medium\r\n    desiredCapacity: 1\r\n    minSize: 0\r\n    maxSize: 3\r\n    privateNetworking: true\r\n    iam:\r\n      withAddonPolicies:\r\n        autoScaler: true\r\n        externalDNS: true\r\n    volumeSize: 20\r\n    ssh:\r\n      allow: false\r\n<\/pre>\n<p>\u3053\u308c\u3092 cluster-config.yaml \u3068\u3044\u3046\u540d\u524d\u3067\u4fdd\u5b58\u3057\u3066\u3001 eksctl \u3092\u5b9f\u884c<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\neksctl create cluster -f cluster-config.yaml\r\n<\/pre>\n<p>\u4f5c\u6210\u3067\u304d\u305f\u3089 .\/kube\/config \u3092\u4f5c\u308b<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\naws eks update-kubeconfig --region ap-northeast-1 --name my-cluster-name\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u3002Service\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get svc\r\nkubectl get nodes\r\n<\/pre>\n<p>security group \u306f\u3001\u4f7f\u3046\u30dd\u30fc\u30c8\u3084\u7528\u9014\u306b\u5408\u308f\u305b\u3066\u4efb\u610f\u3067\u7de8\u96c6\u3059\u308b\u3002<\/p>\n<p>\u4f5c\u3063\u305f EKS clusters + node group \u306f Cloud Formation \u306b\u30b9\u30bf\u30c3\u30af\u3068\u3057\u3066\u767b\u9332\u3055\u308c\u308b\u306e\u3067\u3001\u7528\u304c\u6e08\u3093\u3060\u3089\u30b9\u30bf\u30c3\u30af\u3054\u3068\u6d88\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u65b0\u3057\u3044\u30af\u30e9\u30b9\u30bf\u30fc\u3092\u4f5c\u3063\u305f\u6642\u306b\u5fc5\u8981\u306a\u306e\u3067\u30e1\u30e2\u3002 kubectl \u3092\u5f53\u7136\u5148\u306b\u5165\u308c\u3066\u304a\u304f\u3002\u4eca\u56de\u306f\u30d0\u30fc\u30b8\u30e7\u30f3\u6307\u5b9a\u3067 1.26.9 \u3092\u4f7f\u3046\u3002 \u305d\u306e\u4ed6\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f \u30ea\u30ea\u30fc\u30b9\u30ce\u30fc\u30c8 \u3067\u78ba\u8a8d\u3002 curl -LO http [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,32,8],"tags":[],"class_list":["post-1937","post","type-post","status-publish","format-standard","hentry","category-aws","category-kubernetes","category-linux"],"_links":{"self":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/comments?post=1937"}],"version-history":[{"count":7,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1937\/revisions"}],"predecessor-version":[{"id":2302,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/1937\/revisions\/2302"}],"wp:attachment":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/media?parent=1937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/categories?post=1937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/tags?post=1937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}