1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Kubernetes v1.24 からServiceAccountには自動でSecret Tokenは生成されなくなったことによる問題対応

Posted at

Kubernetes 変更点

Kubernetes v1.24からServiceAccountを作成しても自動でSecret Tokenは生成されなくなった。

公式: 1.24.0 release notes 該当箇所

事象

ArgoWorkflowサーバにて、v1.24以降に作成したTokenが存在しないServiceAccount紐づけユーザーでログインするとRoleの機能を実施することができずエラーになった。(Tokenが無いためRBAC認可の内容を実施できない状態であった。)

エラー内容

エラ-1

{"code":7,"message":"not allowed"}: not allowed

image.png

エラー2

Connection closed to api/v1/workflow-events/...

image.png

対応

ServiceAccount用のSecretリソースを明示的に作成するようにすることでTokenがServiceAccountに付与されるようになった。

ServiceAccount (既存で存在している)

apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-service-account
  namespace: default
  annotations:
    workflows.argoproj.io/rbac-rule: "'<GROUP_OBJECT_ID>' in groups"
    workflows.argoproj.io/rbac-rule-precedence: "1"

Secrets(新規作成)

apiVersion: v1
kind: Secret
metadata:
  name: my-service-account.service-account-token # name is discoverable. ref. https://argoproj.github.io/argo-workflows/manually-create-secrets/#option-1-discovery-by-name
  annotations:
    kubernetes.io/service-account.name: my-service-account
type: kubernetes.io/service-account-token

上記Apply後、以下のようにServiceAccountのTokensに新規追加したSecretが自動で適用され、エラーが解消された。

$ kubectl describe serviceaccount my-service-account
Name:                my-service-account
Namespace:           default
.
.
.
Mountable secrets:   <none>
Tokens:              my-service-account.service-account-token
Events:              <none>

参考

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?