当前位置:网站首页>eksctl 部署AWS EKS
eksctl 部署AWS EKS
2022-04-23 04:14:00 【沉淅尘】
目录
一、工具安装
1.1 安装kubectl
在 Linux 上安装 kubectl
-
从 Amazon S3 为集群的 Kubernetes 版本下载 Amazon EKS 提供的
kubectl
二进制文件。要下载 Arm 版本,请先将amd64
更改为arm64
,然后再运行相应命令。-
Kubernetes 1.21:
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl
-
Kubernetes 1.20:
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.20.4/2021-04-12/bin/linux/amd64/kubectl
-
Kubernetes 1.19:
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl
-
Kubernetes 1.18:
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.18.9/2020-11-02/bin/linux/amd64/kubectl
-
-
将执行权限应用于二进制文件。
chmod +x ./kubectl
-
将二进制文件复制到您的
PATH
中的文件夹。如果您已经安装了某个版本的kubectl
,建议您创建一个$HOME/bin/kubectl
并确保$HOME/bin
先出现在您的$PATH
中。mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin
-
(可选) 将
$HOME/bin
路径添加到 shell 初始化文件,以便在打开 shell 时配置此路径。注意
这一步假设您使用 Bash Shell;如果使用其他 Shell,请将命令更改为使用您的特定 Shell 的初始化文件。
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
-
安装
kubectl
后,可以使用以下命令验证其版本:kubectl version --short --client
1.2 安装eksctl
使用 eksctl
在 Linux 上安装或升级 curl
-
使用以下命令下载并提取最新版本的
eksctl
。curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
-
将提取的二进制文件移至
/usr/local/bin
。sudo mv /tmp/eksctl /usr/local/bin
-
使用以下命令测试您的安装是否成功。
eksctl version
1.3 安装Helm(可选)
-
如果您将 macOS 与 Homebrew 配合使用,请使用以下命令安装二进制文件。
brew install helm
-
如果您将 Windows 与 Chocolatey 配合使用,请使用以下命令安装二进制文件。
choco install kubernetes-helm
-
如果您正在使用 Linux,请使用以下命令来安装二进制文件。
$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 $ chmod 700 get_helm.sh $ ./get_helm.sh
二、命令式创建
2.1 创建Amazon EC2 Linux托管节点集群
eksctl create cluster \
--name my-cluster \
--region us-west-2 \
--with-oidc \
--ssh-access \
--ssh-public-key <your-key> \
--managed
2.2 创建Fargate Linux节点
eksctl create cluster \
--name my-cluster \
--region us-west-2 \
--fargate
2.3 查看资源
kubectl get nodes -o wide
2.4 删除集群
eksctl delete cluster --name my-cluster --region us-west-2
三、配置文件(yaml)创建
3.1 不选择VPC
nodeGroups
是非托管的节点组,managedNodeGroups
为EKS托管节点组,托管节点组能够在控制台显示。
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: basic-cluster
region: eu-north-1
nodeGroups:
- name: ng-1
instanceType: m5.large
desiredCapacity: 10
volumeSize: 80
ssh:
allow: true # will use ~/.ssh/id_rsa.pub as the default ssh key
- name: ng-2
instanceType: m5.xlarge
desiredCapacity: 2
volumeSize: 100
ssh:
publicKeyPath: ~/.ssh/ec2_id_rsa.pub
managedNodeGroups:
- name: ng-1-workers
labels: {
role: workers }
instanceType: m5.xlarge
desiredCapacity: 10
volumeSize: 80
privateNetworking: true
- name: ng-2-builders
labels: {
role: builders }
instanceType: m5.2xlarge
desiredCapacity: 2
volumeSize: 100
privateNetworking: true
3.2 选择现有VPC
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: cluster-in-existing-vpc
region: eu-north-1
vpc:
subnets:
private:
eu-north-1a: {
id: subnet-0ff156e0c4a6d300c }
eu-north-1b: {
id: subnet-0549cdab573695c03 }
eu-north-1c: {
id: subnet-0426fb4a607393184 }
nodeGroups:
- name: ng-1-workers
labels: {
role: workers }
instanceType: m5.xlarge
desiredCapacity: 10
privateNetworking: true
- name: ng-2-builders
labels: {
role: builders }
instanceType: m5.2xlarge
desiredCapacity: 2
privateNetworking: true
iam:
withAddonPolicies:
imageBuilder: true
3.3 运行创建命令
eksctl create cluster -f cluster.yaml
3.4 删除集群
eksctl delete cluster -f cluster.yaml
参考
eksctl:https://eksctl.io/introduction/
AWS EKS文档: https://docs.aws.amazon.com/zh_cn/eks/latest/userguide/what-is-eks.html
版权声明
本文为[沉淅尘]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_41335923/article/details/121330978
边栏推荐
- 【ICCV 2019】MAP-VAE:Multi-Angle Point Cloud-VAE: Unsupervised Feature Learning for 3D Point Clouds..
- Network principle | connection management mechanism in TCP / IP important protocol and core mechanism
- Shopping mall for transportation tools based on PHP
- matlab读取多张fig图然后合并为一张图(子图的形式)
- 【李宏毅2022 机器学习春】hw6_GAN(不懂..)
- Machine translation baseline
- 基于PHP的代步工具购物商城
- Add the compiled and installed Mysql to the path environment variable
- [Li Hongyi 2022 machine learning spring] hw6_ Gan (don't understand...)
- STM32F4单片机ADC采样及ARM-DSP库的FFT
猜你喜欢
matlab讀取多張fig圖然後合並為一張圖(子圖的形式)
【论文阅读】【3d目标检测】Improving 3D Object Detection with Channel-wise Transformer
【BIM+GIS】ArcGIS Pro2. 8 how to open Revit model, Bim and GIS integration?
无线充电全国产化电子元件推荐方案
Solve the technical problems in seq2seq + attention machine translation
Difference between LabVIEW small end sequence and large end sequence
Why recommend you to study embedded
The whole process of connecting the newly created unbutu system virtual machine with xshell and xftp
【BIM入门实战】Revit建筑墙体:构造、包络、叠层图文详解
Thought of reducing Governance -- detailed summary of binary search
随机推荐
ERROR: Could not find a version that satisfies the requirement win32gui
What is software acceptance testing? What are the benefits of acceptance testing conducted by third-party software testing institutions?
[mapping program design] coordinate azimuth calculation artifact (version C)
QtSpim手册-中文翻译
Writing latex with vscode - the latest tutorial 2022 / 4 / 17
C语言:恶搞小游戏
Solve the technical problems in seq2seq + attention machine translation
STM32F4单片机ADC采样及ARM-DSP库的FFT
Single chip microcomputer serial port data processing (1) -- serial port interrupt sending data
Mysql出现2013 Lost connection to MySQL server during query
Shopping mall for transportation tools based on PHP
[AI vision · quick review of NLP natural language processing papers today, issue 28] wed, 1 Dec 2021
[echart] Introduction to echart
The whole process of connecting the newly created unbutu system virtual machine with xshell and xftp
小红书被曝整体裁员20%,大厂之间内卷也很严重
[string] ranking of country names ----- problem solving notes
CRF based medical entity recognition baseline
Chlamydia infection -- causes, symptoms, treatment and Prevention
Matlab reads multiple fig graphs and then combines them into one graph (in the form of sub graph)
Nel ASA:挪威Herøya设施正式启用