Amazon EKS에서 End of service 때문에 EKS 버전을 업그레이드 하라는 메일을 받았다.
원래 사용하고 있던 버전은 1.18인데 2022년 3월 31일부로 종료된다고 하여 부랴부랴 업그레이드를 하였다.
1.22까지 다 업그레이드 하였으면 좋았겠지만 사정상 1.21까지 업그레이드를 하고 모든 서비스들이 정상 동작하는 것을 확인 했는데
유독 Vault가 정상 동작하지 않는 현상을 확인하였다.
일단 우리의 상황은 아래와 같았다.
Vault version : 1.7.2
Amazon EKS Version : 1.2.1(기존 1.1.8 에서 업그레이드)
2022-03-03T23:58:29.395Z [ERROR] auth.handler: error authenticating: error=“context deadline exceeded” backoff=1s
2022-03-03T23:58:30.395Z [INFO] auth.handler: authenticating
2022-03-03T23:59:30.396Z [ERROR] auth.handler: error authenticating: error=“context deadline exceeded” backoff=1.89s
2022-03-03T23:59:32.295Z [INFO] auth.handler: authenticating
2022-03-04T00:00:32.296Z [ERROR] auth.handler: error authenticating: error=“context deadline exceeded” backoff=3.06s
2022-03-04T00:00:35.357Z [INFO] auth.handler: authenticating
2022-03-04T00:01:35.357Z [ERROR] auth.handler: error authenticating: error=“context deadline exceeded” backoff=5.72s
2022-03-04T00:01:41.078Z [INFO] auth.handler: authenticating
2022-03-04T00:02:41.079Z [ERROR] auth.handler: error authenticating: error=“context deadline exceeded” backoff=10.32s
Vault가 쿠버네티스 서버의 공개키와 토큰을 공유하는데 여기서 문제가 생긴듯 하였다.
그래서 해당 pod의 에러가 저렇게 끝도 없이 올라가는 상황이 발생된 것이다.
가장 흔한 방법인 에러 코드로 검색을 해 보았더니 아래 사이트가 나와서 확인을 하였다.
https://github.com/hashicorp/vault-helm/issues/562
Vault agent can't authenticate using k8s 1.21 · Issue #562 · hashicorp/vault-helm
Describe the bug Since I updated kind to 0.11, which by default uses k8s 1.21, my sidecar vault-agents can't authenticate with Vault showing the following error: [ERROR] auth.handler: error aut...
github.com
가만 보니 인증 방법에 대해 문제가 생긴듯 하였다.
여러가지 방법을 제공 해 줬는데 최종적으로 내가 사용한 방법은 아래 사이트를 참고하여 진행 하였다.
이 사이트에선 1.9.x 버전에 대해 설명이 있어 우리 버전과 안맞으면 어쩌나 했는데 다행이 문제가 없었다.
https://www.vaultproject.io/docs/auth/kubernetes
Kubernetes - Auth Methods | Vault by HashiCorp
The Kubernetes auth method allows automated authentication of Kubernetes Service Accounts.
www.vaultproject.io
disable_iss_validation=true
위와 같은 변수 값에 true를 줘서 issuer validation을 패스하는 방법을 사용하였다.
결론적으로 아래와 같이 명령어를 실행하였다.
vault write auth/kubernetes/config \
token_reviewer_jwt="$SA_JWT_TOKEN" \
kubernetes_host="$K8S_HOST" \
kubernetes_ca_cert="$SA_CA_CRT" \
disable_iss_validation=true
정상적으로 설정 되었는지는 다음 명령어를 통해서 확인 해 볼 수 있었다.
vault read -field disable_iss_validation auth/kubernetes/config
이 명령어를 실행하였을 때 true 값이 나온다면 정상적으로 명령어가 실행 되었다고 보면 된다.
마지막으로 pod를 삭제하고 재실행해서 정상적으로 Vault가 돌아가는지 확인하면 되겠다.
kubectl delete pod vault-0
auth를 변경하고 나서도 정상동작하지 않아 Vault를 1.9.x 등의 최신 버전으로 업그레이드 해야 되나 하고 있었는데 최종적으로는 잘 되어사 다행이다.
'AWS' 카테고리의 다른 글
AWS Solutions Architect 직급체계 I? II? III? L4? L5? L6? (2) | 2022.09.26 |
---|---|
AWS Abuse Report (0) | 2022.01.27 |
댓글