Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
EKS Anywhere on vSphere
Search
masanara
September 21, 2021
Technology
0
41
EKS Anywhere on vSphere
2021年9月10日にEKS AnywhereがGAされ たのでvSpehre上にイントールして使ってみ た。
masanara
September 21, 2021
Tweet
Share
More Decks by masanara
See All by masanara
vSphere環境でLLMをServeする
masanara
0
200
Cartographer入門
masanara
0
460
kpackによるコンテナイメージのビルド
masanara
0
100
Harbor RegistryのReplication機能
masanara
0
290
Kubernetes Operator for vSphere VM
masanara
0
51
Other Decks in Technology
See All in Technology
登壇ネタの見つけ方 / How to find talk topics
pinkumohikan
5
570
AI導入の理想と現実~コストと浸透〜
oprstchn
0
140
Amazon S3標準/ S3 Tables/S3 Express One Zoneを使ったログ分析
shigeruoda
5
580
自律的なスケーリング手法FASTにおけるVPoEとしてのアカウンタビリティ / dev-productivity-con-2025
yoshikiiida
0
220
AIとともに進化するエンジニアリング / Engineering-Evolving-with-AI_final.pdf
lycorptech_jp
PRO
0
140
高速なプロダクト開発を実現、創業期から掲げるエンタープライズアーキテクチャ
kawauso
1
120
Model Mondays S2E03: SLMs & Reasoning
nitya
0
230
SpringBoot x TestContainerで実現するポータブル自動結合テスト
demaecan
0
110
ネットワーク保護はどう変わるのか?re:Inforce 2025最新アップデート解説
tokushun
0
140
GeminiとNotebookLMによる金融実務の業務革新
abenben
0
240
Claude Code Actionを使ったコード品質改善の取り組み
potix2
PRO
6
2.6k
PHP開発者のためのSOLID原則再入門 #phpcon / PHP Conference Japan 2025
shogogg
4
920
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
246
12k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
720
Building Adaptive Systems
keathley
43
2.6k
Become a Pro
speakerdeck
PRO
28
5.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Speed Design
sergeychernyshev
32
1k
Transcript
EKS Anywhere on vSphere VMware DevOps Meetup #10 2021/09/22
本日の内容 2021年9月10日にEKS AnywhereがGAされ たのでvSpehre上にイントールして使ってみ た。 - クラスターの作成方法 - GitOpsの利用 -
EKS Connectorの利用 https://qiita.com/masanara/items/8643205083e8560c30f3
EKS Anywhereとは • Amazon EKSで利用されているKuberentesディストリビューションであるAmazon EKS Distroをオンプレミス環境で利用するためのもの。 • Cluster APIでKubernetesクラスターをプロビジョニング。
• 現在vSphereもしくはDockerに対応。今後ベアメタルにも対応予定。 • クラスターデプロイ時のオプションでFluxを構成してGitOpsが可能。 • 使うだけなら無料。サポートはAWSが有償提供。 • EKS Anywhere Documentation https://anywhere.eks.amazonaws.com/docs/overview/
事前準備 • Bootstrapノード (kind) ◦ 4 CPU cores / 16GB
memory ◦ Mac OS(10.15)/Ubuntu (20.04.2 LTS) ◦ Docker 20.x.x • vSphere ◦ vSphere 7以上 ◦ EKS Anywhereクラスターを実行するポートグループで DHCPを有効化 ◦ EKS Anywhereクラスターを実行するポートグループでクラスターの APIが利用する固定IPアドレス の確保 ◦ 仮想マシンインベントリに VMテンプレートを格納するための Templatesフォルダを作成 • GitHub ◦ GitOpsを利用する場合、GitHubアカウントでrepoスコープのアクセス権を持つ Personal access tokenを作成
EKS Anywhereの準備 eksctlとeksctl-anywhereプラグインのインストール。 curl "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" \ --silent --location \
| tar xz -C /tmp sudo mv /tmp/eksctl /usr/local/bin/ export EKSA_RELEASE="0.5.0" OS="$(uname -s | tr A-Z a-z)" curl "https://anywhere-assets.eks.amazonaws.com/releases/eks-a/1/artifacts/eks-a/v${EKSA_RELEASE}/${OS}/eksctl-anywhere -v${EKSA_RELEASE}-${OS}-amd64.tar.gz" \ --silent --location \ | tar xz ./eksctl-anywhere sudo mv ./eksctl-anywhere /usr/local/bin/ eksctl anywhere version v0.5.0
クラスター設定ファイルの作成 eksctl anywhereコマンドを利用してクラスター設定ファイルを作成する。 eksctl anywhere generate clusterconfig eksacl --provider vsphere
> eksa-cluster.yaml grep -B1 ^kind eksa-cluster.yaml apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: Cluster -- apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: VSphereDatacenterConfig -- apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: VSphereMachineConfig -- apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: VSphereMachineConfig -- apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: VSphereMachineConfig https://anywhere.eks.amazonaws.com/docs/reference/clusterspec/
クラスターのAPIのアドレスや構成するノードの数等を指定する。 設定ファイルの編集 : Cluster apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: Cluster metadata: name:
eksacl spec: clusterNetwork: cni: cilium pods: cidrBlocks: - 192.168.0.0/16 services: cidrBlocks: - 10.96.0.0/12 controlPlaneConfiguration: count: 2 endpoint: host: "192.168.30.100" machineGroupRef: kind: VSphereMachineConfig name: eksacl-cp datacenterRef: kind: VSphereDatacenterConfig name: eksacl externalEtcdConfiguration: count: 3 machineGroupRef: kind: VSphereMachineConfig name: eksacl-etcd kubernetesVersion: "1.21" workerNodeGroupConfigurations: - count: 2 machineGroupRef: kind: VSphereMachineConfig name: eksacl gitOpsRef: kind: GitOpsConfig name: eksacl GitOpsを有効化する場合は、 spec.gitOpsRefを追 加する。
EKSクラスター作成先のvCenter、データセンター名、ポートグループ名を指定する。 設定ファイルの編集 : VSphereDatacenterConfig apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: VSphereDatacenterConfig metadata: name:
eksacl spec: datacenter: "Tanzu-DC" insecure: true network: "/Tanzu-DC/Network/eks" server: "tanzu-vc.example.com" thumbprint: "" insecure : true でvCenterの証明書確認をスキップできる。
設定ファイルの編集 : VSphereMachineConfig 作成する仮想マシンの構成を指定する。コントロールプレーン、ノード、etcdクラスターそ れぞれに対して、異なる設定が可能。 apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: VSphereMachineConfig metadata:
name: eksacl-cp|eksacl|eksacl-etcd spec: datastore: "vsanDatastore" diskGiB: 25 folder: "" memoryMiB: 8192 numCPUs: 2 osFamily: bottlerocket resourcePool: "/Tanzu-DC/host/Tanzu-Cluster/Resources/eks" users: - name: ec2-user sshAuthorizedKeys: - ssh-rsa AAAA... osFamiliyは bottlerocket もしくは ubuntu を指定可能。 bottlerocket : コンテナの実行に最適化され たAWSのLinuxディストリビューション https://aws.amazon.com/bottlerocket/
設定ファイルの編集 : GitOpsConfig クラスター内に構成されるFluxが参照するGitHubの情報を指定する。 apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: GitOpsConfig metadata: name:
eksacl spec: flux: github: branch: main clusterConfigPath: clusters/eksacl fluxSystemNamespace: flux-system owner: masanara personal: true repository: eksagitops
クラスターの作成 GitHubのPersonal Acess Token、vSphereのクレデンシャルを環境変数として指定して から、eksctl anywhereコマンドでクラスターを作成する。 export EKSA_GITHUB_TOKEN=ghp_MyValidPersonalAccessTokenWithRepoPermissions export EKSA_VSPHERE_USERNAME='
[email protected]
'
export EKSA_VSPHERE_PASSWORD='VMware1!' eksctl anywhere create cluster -f eksa-cluster.yaml ... ... ... ... Writing cluster config file Deleting bootstrap cluster 🎉 Cluster created! etcd master Unstacked/External etcd • マスターとetcdを分離することで、マスターの障害や kube-apiserverのメモリーリークか らetcdを守ることができる。 • etcdはリソース消費が多いため、マスターから独立することが望ましい。 • masterと統合する構成も可能。 https://anywhere.eks.amazonaws.com/docs/reference/clusterspec/etcd/
クラスター名のディレクトリ内に作成したクラスターにアクセスするためのkubeconfigが 作成されている。 クラスターの利用 export KUBECONFIG=eksacl/eksacl-eks-a-cluster.kubeconfiga kubectl config get-contexts CURRENT NAME
CLUSTER AUTHINFO NAMESPACE * eksacl-admin@eksacl eksacl eksacl-admin kubectl get node NAME STATUS ROLES AGE VERSION 192.168.201.128 Ready control-plane,master 5m40s v1.21.3 192.168.201.16 Ready control-plane,master 7m29s v1.21.3 192.168.201.32 Ready <none> 6m4s v1.21.3 192.168.201.64 Ready <none> 6m5s v1.21.3 { "architecture": "amd64", "bootID": "26b30dfb-7a90-47de-9d39-b8b0e5630861", "containerRuntimeVersion": "containerd://1.4.8+bottlerocket", "kernelVersion": "5.10.50", "kubeProxyVersion": "v1.21.3", "kubeletVersion": "v1.21.3", "machineID": "76ba2e4266991c3605db79339c867c8f", "operatingSystem": "linux", "osImage": "Bottlerocket OS 1.2.0", "systemUUID": "76ba2e42-6699-1c36-05db-79339c867c8f" }
GitOpsの利用 GitOpsを有効にすることで、作成されるクラスターでFluxが有効化され、GitOpsConfig で指定したGitHubリポジトリにクラスターの設定ファイルが置かれる。 kubectl get pod -n flux-system NAME READY
STATUS RESTARTS AGE helm-controller-6d875c9745-mm4c4 1/1 Running 0 122m kustomize-controller-74c85f9944-nqlkh 1/1 Running 0 122m notification-controller-7c59756d9d-8lplx 1/1 Running 0 122m source-controller-65dcfdf7f7-57kwr 1/1 Running 0 122m
GitOpsの利用 FluxはGitHubリポジトリをポーリングし、変更があると変更内容をクラスターに反映す る。 apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: Cluster metadata: creationTimestamp: null
name: eksacl spec: workerNodeGroupConfigurations: - count: 3 apiVersion: anywhere.eks.amazonaws.com/v1alpha1 kind: Cluster metadata: creationTimestamp: null name: eksacl spec: workerNodeGroupConfigurations: - count: 2
Kubernetes環境のService(type:LoadBalancer)をNSX Advanced LoadBalancerで提 供可能。 Avi Kubernetes Operator https://qiita.com/masanara/items/23fc3dfc5568356ca986
GitOpsを利用したAvi Kubernetes Operatorの構成 HelmRepository/HelmRelaseを利用してEKS Anywhereクラスター上にAvi Kuubernetes Operatorを構成可能。 apiVersion: v1 kind:
Namespace metadata: name: avi-system --- apiVersion: source.toolkit.fluxcd.io/v1beta1 kind: HelmRepository metadata: name: ako namespace: avi-system spec: interval: 5m url: https://projects.registry.vmware.com/chartrepo/ako --- apiVersion: helm.toolkit.fluxcd.io/v2beta1 kind: HelmRelease metadata: name: ako namespace: avi-system spec: interval: 5m chart: spec: chart: ako version: ">=1.5.0" sourceRef: kind: HelmRepository name: ako namespace: avi-system interval: 1m valuesFrom: - kind: ConfigMap name: ako-values
EKS Connector EKS以外のKubernetesクラスターをAWSマネジメントクラスターから管理可能にする。
EKS Connector Tanzu Kubernetes Clusterも登録できました。
EKS AnywhereとTanzu Kubernetes Grid 同じCluster APIを利用しているが、作成されるクラスターの実装は異なる。 EKS Anywhere Tanzu Kubernetes
Grid 実行環境 vSphere (Docker) vSphere/AWS/Azure etcd Unstacked/External Stacked ClusterAPI セルフホスト Management Clsuter CNI Cilium Antrea/Calico CSI vSphere CSI vSphere CSI LoadBalancer なし (kube-vip推奨) NSX-T/NSX-ALB GitOps Flux kapp controller https://anywhere.eks.amazonaws.com/docs/tasks/cluster/cluster-integrations/
自宅 EKS Anywhere $ eksctl anywhere generate clusterconfig -p docker
docker-eksa > docker-eksa.yaml $ eksctl anywhere create cluster -f docker-eksa.yaml Performing setup and validations Warning: The docker infrastructure provider is meant for local development and testing only ✅ Docker Provider setup is valid Creating new bootstrap cluster Installing cluster-api providers on bootstrap cluster Provider specific setup Creating new workload cluster Installing networking on workload cluster Installing storage class on workload cluster Installing cluster-api providers on workload cluster Moving cluster management from bootstrap to workload cluster Installing EKS-A custom components (CRD and controller) on workload cluster Creating EKS-A CRDs instances on workload cluster Installing AddonManager and GitOps Toolkit on workload cluster GitOps field not specified, bootstrap flux skipped Writing cluster config file Deleting bootstrap cluster 🎉 Cluster created! $ KUBECONFIG=docker-eksa/docker-eksa-eks-a-cluster.kubeconfig kubectl get node NAME STATUS ROLES AGE VERSION docker-eksa-8qrj4 Ready control-plane,master 4m34s v1.21.2-eks-1-21-4 docker-eksa-md-0-6b766ff5d9-bqdpc Ready <none> 3m58s v1.21.2-eks-1-21-4 $ docker ps --format "table {{.Image}}\t{{.Ports}}\t{{.Names}}" IMAGE PORTS NAMES public.ecr.aws/eks-anywhere/kubernetes-sigs/kind/node:v1.21.2-eks-d-1-21-4-eks-a-1 docker-eksa-md-0-6b766ff5d9-bqdpc public.ecr.aws/eks-anywhere/kubernetes-sigs/kind/node:v1.21.2-eks-d-1-21-4-eks-a-1 42239/tcp, 127.0.0.1:42239->6443/tcp docker-eksa-8qrj4 public.ecr.aws/eks-anywhere/kubernetes-sigs/kind/node:v1.21.2-eks-d-1-21-4-eks-a-1 docker-eksa-etcd-9swbk kindest/haproxy:v20210715-a6da3463 40519/tcp, 0.0.0.0:40519->6443/tcp docker-eksa-lb
ありがとうございました