[英]AWS CodeBuild kubectl apply -f unable to recognize : Unauthorized
構建過程因以下錯誤而失敗:
[Container] 2019/12/12 08:07:41 Running command kubectl apply -f simple_jwt_api.yml
unable to recognize "simple_jwt_api.yml": Unauthorized
unable to recognize "simple_jwt_api.yml": Unauthorized
[Container] 2019/12/12 08:07:43 Command did not exit successfully kubectl apply -f simple_jwt_api.yml exit status 1
[Container] 2019/12/12 08:07:43 Phase complete: POST_BUILD State: FAILED
[Container] 2019/12/12 08:07:43 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: kubectl apply -f simple_jwt_api.yml. Reason: exit status 1
simple_jwt_api.yml 文件: simple_jwt_api.yml
構建腳本文件: buildspec.yml
構建日志:
[Container] 2019/12/12 08:07:41 Running command kubectl apply -f simple_jwt_api.yml
unable to recognize "simple_jwt_api.yml": Unauthorized
unable to recognize "simple_jwt_api.yml": Unauthorized
[Container] 2019/12/12 08:07:43 Command did not exit successfully kubectl apply -f simple_jwt_api.yml exit status 1
[Container] 2019/12/12 08:07:43 Phase complete: POST_BUILD State: FAILED
[Container] 2019/12/12 08:07:43 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: kubectl apply -f simple_jwt_api.yml. Reason: exit status 1
[Container] 2019/12/12 08:07:43 Expanding base directory path: .
[Container] 2019/12/12 08:07:43 Assembling file list
[Container] 2019/12/12 08:07:43 Expanding .
[Container] 2019/12/12 08:07:43 Expanding file paths for base directory .
[Container] 2019/12/12 08:07:43 Assembling file list
[Container] 2019/12/12 08:07:43 Expanding build.json
[Container] 2019/12/12 08:07:43 Skipping invalid file path build.json
[Container] 2019/12/12 08:07:43 Phase complete: UPLOAD_ARTIFACTS State: FAILED
[Container] 2019/12/12 08:07:43 Phase context status code: CLIENT_ERROR Message: no matching artifact paths found
Buildspec 看起來不錯,所以我懷疑您的 CodeBuild 服務角色在其 ARN (/service-role/) 中有一個“路徑”,已知這會在使用 iam 身份驗證器對 EKS 進行身份驗證時導致問題。
您能否在另一個可能有幫助的線程上查看我的這個答案:
還要檢查“身份驗證器”EKS 控制平面日志,它可能會提供有關“未授權”錯誤的一些線索:
我遇到了同樣的問題。 但是,對我來說,原因是文檔“/tmp/aws-auth-patch.yml”
我沒有正確添加角色。
第一次,我將它添加到 mapUsers 而不是 mapRoles。
其次,我忘了更換 ACCOUNT_ID
第三次,我用錯了格式。
它應該是
然后我得到了正確的結果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.