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
56
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
EKS Anywhere on vSphere
2021年9月10日にEKS AnywhereがGAされ たのでvSpehre上にイントールして使ってみ た。
masanara
September 21, 2021
More Decks by masanara
See All by masanara
vSphere環境でLLMをServeする
masanara
0
290
Cartographer入門
masanara
0
530
kpackによるコンテナイメージのビルド
masanara
0
130
Harbor RegistryのReplication機能
masanara
0
440
Kubernetes Operator for vSphere VM
masanara
0
67
Other Decks in Technology
See All in Technology
Backstageでつくるセルフサービスな社内開発基盤
kikunosuke75
1
240
【Oracle AI Spotlight ウェビナー】AWSか、Azureか、Google Cloudか。その議論にオラクルを含める意義。
oracle4engineer
PRO
2
220
Amazon S3 Tablesに全部任せてみた結果——コンパクション/スナップショット管理は本当に手放せるか
shigeruoda
0
340
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
240
Kiro Crewしか勝たん!?
miu_crescent
PRO
0
170
[RSJ26] Building a VLA Model Based on Self-Distilled Classification
keio_smilab
PRO
0
190
Genie Code ワークショップ 応用編 / Genie-Code-Workshop-advanced
databricksjapan
PRO
0
310
少人数データチームのDevin活用実践事例
runandy16
2
430
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
150
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
380
Self Healing Rollouts: Automating Production Fixes with Agentic AI
kdubois
0
150
推論の観測、できていますか? 〜 Google Cloud Gemini Enterprise Agent Platformで 3つの Gemini モデルを実測して踏んだ、評価の罠 〜
shukob
PRO
0
140
Featured
See All Featured
Music & Morning Musume
bryan
47
7.4k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
470
How STYLIGHT went responsive
nonsquared
100
6.3k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
660
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
310
Agile that works and the tools we love
rasmusluckow
331
22k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Claude Code のすすめ
schroneko
67
230k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
720
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
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
ありがとうございました