LoginSignup
1
1

More than 3 years have passed since last update.

eksctl を使用して Fargate for EKS を試してみた。

Posted at

前提条件

eksctl のバージョンは次のとおりです。

% eksctl version
[ℹ]  version.Info{BuiltAt:"", GitCommit:"", GitTag:"0.11.0"}

eksctl の認証

--profile オプションを使用して ~/.aws/config のプロファイルを選択できます。

% eksctl get clusters --profile dummy
No clusters found

EKS クラスタの構築

公式サイトの案内の通り、--fargate オプションを eksctl create cluster へ付加するだけです。

% eksctl create cluster --fargate --profile dummy
[ℹ]  eksctl version 0.11.0
[ℹ]  using region ap-northeast-1

...長いので省略

しばらく待つと EKS クラスタが構築されます。

[✔]  EKS cluster "ferocious-painting-xxxxxxxxxx" in "ap-northeast-1" region is ready

kubectl コマンドからノードを確認します。

% kubectl get node
NAME                                                         STATUS   ROLES    AGE     VERSION
fargate-ip-192-168-130-xxx.ap-northeast-1.compute.internal   Ready    <none>   2m54s   v1.14.8-eks
fargate-ip-192-168-143-xxx.ap-northeast-1.compute.internal    Ready    <none>   3m3s    v1.14.8-eks

Kubernetes のノードが Fargate で構成されていることがわかります。

Pod のデプロイ

nginx の Pod をデプロイします。

% kubectl apply -f https://k8s.io/examples/application/deployment.yaml
deployment.apps/nginx-deployment created

当然ですが、問題なくデプロイできました。

% kubectl describe deployment nginx-deployment
Name:                   nginx-deployment
Namespace:              default
CreationTimestamp:      Thu, 05 Dec 2019 22:26:45 +0900
Labels:                 <none>
Annotations:            deployment.kubernetes.io/revision: 1
                        kubectl.kubernetes.io/last-applied-configuration:
                          {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},"spec":{"replica
...
Selector:               app=nginx
Replicas:               2 desired | 2 updated | 2 total | 0 available | 2 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=nginx
  Containers:
   nginx:
    Image:        nginx:1.7.9
    Port:         80/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      False   MinimumReplicasUnavailable
  Progressing    True    ReplicaSetUpdated
OldReplicaSets:  <none>
NewReplicaSet:   nginx-deployment-6dd86d77d (2/2 replicas created)
Events:
  Type    Reason             Age   From                   Message
  ----    ------             ----  ----                   -------
  Normal  ScalingReplicaSet  7s    deployment-controller  Scaled up replica set nginx-deployment-6dd86d77d to 2

後始末

次のコマンドから今回作成した EKS クラスタを削除できます。

eksctl delete cluster type_your_cluster_name --profile dummy

今回は試していませんが、--wait フラグをコマンドへ付加すると CloudFormation の stack が完全に削除されるまで待機してくれるようです。詳しくは次のページに記載されています。
https://eksctl.io/usage/creating-and-managing-clusters/

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1