2021年9月28日火曜日

EKSのクラスター(Cluster Autoscaler)

1)IAMロール、ポリシーを作成する。

cluster-autoscaler-policy.json

======================================

{

    "Version": "2012-10-17",

    "Statement": [

        {

            "Action": [

                "autoscaling:DescribeAutoScalingGroups",

                "autoscaling:DescribeAutoScalingInstances",

                "autoscaling:DescribeLaunchConfigurations",

                "autoscaling:DescribeTags",

                "autoscaling:SetDesiredCapacity",

                "autoscaling:TerminateInstanceInAutoScalingGroup",

                "ec2:DescribeLaunchTemplateVersions"

            ],

            "Resource": "*",

            "Effect": "Allow"

        }

    ]

}

====================================


2)ポリシーの作成を行う。

=======================================

aws iam create-policy \

    --policy-name AmazonEKSClusterAutoscalerPolicy \

    --policy-document file://cluster-autoscaler-policy.json

=========================================



以下、実行結果














IAMでも確認

(AmazonEKSClusterAutoscalerPolicy が追加されてますね。)









■Cluster Auto Scaling をデプロイする


1)以下、マニュフェストを実施する。

kubectl apply -f https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/aws/examples/cluster-autoscaler-autodiscover.yaml






2)上記で作成したIAMロールにアタッチする。

kubectl annotate serviceaccount cluster-autoscaler \

  -n kube-system \





3)cluster-autoscaler.kubernetes.io/safe-to-evict のアノテーションを Cluster Autoscaler ポッドに

追加するうように、デプロイにパッチを適用

kubectl patch deployment cluster-autoscaler \

  -n kube-system \

  -p '{"spec":{"template":{"metadata":{"annotations":{"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"}}}}}'




4)Cluster Autoscaler デプロイを編集する

kubectl -n kube-system edit deployment.apps/cluster-autoscaler


編集前:




















編集後:

















3)cluster-autoscalerの設定を行う。

kubectl set image deployment cluster-autoscaler \

  -n kube-system \

  cluster-autoscaler=k8s.gcr.io/autoscaling/cluster-autoscaler:v1.21.2






4)ログで確認を行う。

kubectl -n kube-system logs -f deployment.apps/cluster-autoscaler





0 件のコメント:

コメントを投稿

test

参照先: https://pecopla.net/seo-column/htaccess-redirect-errors-approach https://www.seohacks.net/blog/1042/ https://htaccess.madewithlove.com/...