Argo WorkflowsでSSOを設定するのにAzureを使って行ってみました。
Argo Workflowsのセットアップ
Argo Workflows自体はHelmを使って設定します。
# Helm
helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
# Deploy Argo workflow
helm upgrade my-workflow argo/argo-workflows -n argo --create-namespace --install -f values.yaml
Helm Chartの詳細はこちらを参考にしました。
SSOのためのシークレット
Microsoft EntraをIdpとして使用するために、App RegistrationのシークレットをKubernetesに作成します。
まずAzureのApp Registrationなどでシークレットを設定。
発行したシークレットをKubernetesのシークレットとして作成。
apiVersion: v1
kind: Secret
metadata:
name: argo-sso
namespace: argo
type: Opaque
stringData:
client-id: "12345678-111b-11aa-ab56-123456789ad"
client-secret: "**********************"
特定のAzure Groupがアクセスできるためのサービスアカウントの設定
AzureのGroupID123456
に所属するユーザがArgoの管理者権限を持つサービスアカウントを使えるように設定。
サービスアカウントとTokenの作成。
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-argo-admin
namespace: argo
annotations:
# The rule is an expression used to determine if this service account
# should be used.
# * `groups` - an array of the OIDC groups
# * `iss` - the issuer ("argo-server")
# * `sub` - the subject (typically the username)
# Must evaluate to a boolean.
# If you want an account to be the default to use, this rule can be "true".
# Details of the expression language are available in
# https://expr-lang.org/docs/language-definition.
workflows.argoproj.io/rbac-rule: "'123456' in groups"
# The precedence is used to determine which service account to use whe
# Precedence is an integer. It may be negative. If omitted, it defaults to "0".
# Numerically higher values have higher precedence (not lower, which maybe
# counter-intuitive to you).
# If two rules match and have the same precedence, then which one used will
# be arbitrary.
workflows.argoproj.io/rbac-rule-precedence: "1"
---
apiVersion: v1
kind: Secret
metadata:
name: my-argo-admin.service-account-token
namespace: argo
annotations:
kubernetes.io/service-account.name: my-argo-admin
type: kubernetes.io/service-account-token
---
サービスアカウントを既存のClusterRoleとClusterRoleBinding。
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: my-argo-admin-access
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: my-workflow-argo-workflows-admin # ClusterRoleはArgo Workflowsセットアップ時に作成される
subjects:
- kind: ServiceAccount
name: my-argo-admin
namespace: argo
これにより、AzureのGroupID123456
に所属するユーザがサービスアカウントmy-argo-admin
をつかってmy-workflow-argo-workflows-admin
で設定してる権限を取得します。
AzureのApp Registration設定
AzureのApp RegistrationでAuthenticationの設定をします。
Redirect URIsにセットアップしたArgoのCallback URLを設定。
SSOのあとGroup IDとemailをArgo Workflowsで使用するのでTokenの設定。
ArgoでSSOを設定
Helmのvalueを変更してSSOを設定します。AzureのGroupID123456
に所属するユーザがSSOできるように設定しています。
server:
authModes: ["sso"]
sso:
clientId:
name: "argo-sso"
key: "client-id"
clientSecret:
name: "argo-sso"
key: "client-secret"
enabled: true
filterGroupsRegex:
- "123456" # AzureのGroup ID
issuer: "https://login.microsoftonline.com/<tenand id>/v2.0"
redirectUrl: "https://myargo.name.company/oauth2/callback"
rbac:
enabled: true
filterGroupsRegex
を使って、必要のあるGroup IDのみ取得します。
Argo WorkflowsにSSO
Argo WorkflowsのGUIからsingle sign-onでLOGINすると、AzureにリダイレクトされてAzureで認証を行いそのあとArgo Workflowsにリダイレクトされます。
認証後はUserから所属のGroup IDやemailが確認できます。