Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS関連のオペレーターをArgoCDに登録したい #1243

Open
3 tasks done
inductor opened this issue Nov 24, 2021 · 8 comments
Open
3 tasks done

AWS関連のオペレーターをArgoCDに登録したい #1243

inductor opened this issue Nov 24, 2021 · 8 comments
Assignees

Comments

@inductor
Copy link
Member

inductor commented Nov 24, 2021

差分追うのが大変なので

  • AWS Load Balancer Controller
  • Cluster Autoscaler on AWS
  • Amazon EBS CSI driver

このへんは全部IRSA + Helmで管理できるので近いうちにやりきりたい

@inductor
Copy link
Member Author

これはまだ課題

@oke-py
Copy link
Member

oke-py commented Dec 2, 2021

@inductor Cluster Autoscalerに取り掛かろうと思うのですが

  • どこに入れますか?(後述のとおり、今はprdのみ)
    • devもautoscaleしたいからdev/prdに入れる
    • devでは使わないけど、検証のためdev/prdに入れる(これだと考えています)
    • prdだけ入れる
  • どうやって入れましたか?

kubectl get crd -o jsonpath='{.items[*]..metadata.name}' | tr -s ' ' '\n'のdevとprdを比較しました。

@@ -1,31 +1,39 @@
 alertmanagerconfigs.monitoring.coreos.com
 alertmanagers.monitoring.coreos.com
 applications.argoproj.io
-applicationtemplates.dreamkast.cloudnativedays.jp
 appprojects.argoproj.io
 certificaterequests.cert-manager.io
 certificates.cert-manager.io
 challenges.acme.cert-manager.io
 clusterissuers.cert-manager.io
+clusterresourcesetbindings.addons.cluster.x-k8s.io
+clusterresourcesets.addons.cluster.x-k8s.io
+clusters.cluster.x-k8s.io
+doclusters.infrastructure.cluster.x-k8s.io
+domachines.infrastructure.cluster.x-k8s.io
+domachinetemplates.infrastructure.cluster.x-k8s.io
 eniconfigs.crd.k8s.amazonaws.com
 extensionservices.projectcontour.io
 externalsecrets.kubernetes-client.io
 httpproxies.projectcontour.io
 ingressclassparams.elbv2.k8s.aws
 issuers.cert-manager.io
-manifeststemplates.dreamkast.cloudnativedays.jp
+kubeadmconfigs.bootstrap.cluster.x-k8s.io
+kubeadmconfigtemplates.bootstrap.cluster.x-k8s.io
+kubeadmcontrolplanes.controlplane.cluster.x-k8s.io
+machinedeployments.cluster.x-k8s.io
+machinehealthchecks.cluster.x-k8s.io
+machinepools.exp.cluster.x-k8s.io
+machines.cluster.x-k8s.io
+machinesets.cluster.x-k8s.io
 orders.acme.cert-manager.io
 podmonitors.monitoring.coreos.com
 probes.monitoring.coreos.com
 prometheuses.monitoring.coreos.com
 prometheusrules.monitoring.coreos.com
-reviewappmanagers.dreamkast.cloudnativedays.jp
-reviewapps.dreamkast.cloudnativedays.jp
+providers.clusterctl.cluster.x-k8s.io
 securitygrouppolicies.vpcresources.k8s.aws
 servicemonitors.monitoring.coreos.com
 targetgroupbindings.elbv2.k8s.aws
 thanosrulers.monitoring.coreos.com
-tlscertificatedelegations.projectcontour.io
-volumesnapshotclasses.snapshot.storage.k8s.io
-volumesnapshotcontents.snapshot.storage.k8s.io
-volumesnapshots.snapshot.storage.k8s.io
\ No newline at end of file
+tlscertificatedelegations.projectcontour.io
\ No newline at end of file

@inductor
Copy link
Member Author

inductor commented Dec 2, 2021

Cluster AutoscalerはHelm使ってないです。もともと公式手順に存在してなかったのでベタで入れましたね
なので手順としてはまるっと消してHelmに置き換えでも良いと思ってます。 @oke-py

dev/prd両方入れないと検証もできないのでそれは揃えましょう

@inductor
Copy link
Member Author

inductor commented Dec 2, 2021

全体の手順は以下のような感じですがeksctlまでは実施する必要はないです(既に実施済みなので)

# Setup Cluster Autoscaler IAM Policy
cat <<EOF > iam-ca.json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "autoscaling:DescribeAutoScalingGroups",
        "autoscaling:DescribeAutoScalingInstances",
        "autoscaling:DescribeLaunchConfigurations",
        "autoscaling:DescribeTags",
        "autoscaling:SetDesiredCapacity",
        "autoscaling:TerminateInstanceInAutoScalingGroup",
        "ec2:DescribeLaunchTemplateVersions"
      ],
      "Resource": ["*"]
    }
  ]
}
EOF

aws iam create-policy \
    --policy-name AWSClusterAutoscalerIAMPolicy \
    --policy-document file://iam-ca.json

eksctl create iamserviceaccount \
--cluster=$CLUSTER_NAME \
--namespace=kube-system \
--name=cluster-autoscaler \
--attach-policy-arn=arn:aws:iam::`aws sts get-caller-identity | jq -r .Account`:policy/AWSClusterAutoscalerIAMPolicy \
--override-existing-serviceaccounts \
--region $CLUSTER_REGION \
--approve

helm upgrade --install cluster-autoscaler autoscaler/cluster-autoscaler \
  -n kube-system \
  --set autoDiscovery.clusterName=$CLUSTER_NAME --set awsRegion=$CLUSTER_REGION --set rbac.serviceAccount.create=false --set rbac.serviceAccount.name=cluster-autoscaler

@oke-py
Copy link
Member

oke-py commented Dec 3, 2021

む、cluster.x-k8s.ioはcluster-autoscaler関連ではないのですね。devにもcluster-autoscaler入っていますわ。

kubectl -n kube-system get deploy -l app=cluster-autoscaler
NAME                 READY   UP-TO-DATE   AVAILABLE   AGE
cluster-autoscaler   1/1     1            1           82d

https://github.com/kubernetes/autoscaler/tree/master/charts/cluster-autoscaler/templates と見比べると

  • devにある
    • ClusterRole
    • ClusterRoleBinding
    • Deployment
    • Role
    • RoleBinding
    • ServiceAccount // helmでは作成しない
  • devにない
    • PodDisruptionBudget
    • PodSecurityPolicy // helmで入れる場合もdisabledになっている
    • ConfigMap cluster-autoscaler-priority-expander
    • PrometheusRule // helmで入れる場合もdisabledになっている
    • Secret // helmで入れる場合も関係なさそう
    • Service
    • ServiceMonitor

@inductor
Copy link
Member Author

inductor commented Dec 3, 2021

cluster.x-k8s.io はEKSが持ってるCluster APIのリソースなので関係ないです

@oke-py
Copy link
Member

oke-py commented Dec 12, 2021

dev-clusterでやりました。

kubectl -n kube-system delete deploy cluster-autoscaler
kubectl delete clusterrolebinding cluster-autoscaler
kubectl delete clusterrole cluster-autoscaler 
kubectl -n kube-system delete rolebinding cluster-autoscaler
kubectl -n kube-system delete role cluster-autoscaler

@inductor
Copy link
Member Author

inductor commented Feb 7, 2022

#1436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants