Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

ERROR:: no kubeconfig file found try adding one at $HOME/.kube/config #1138

Closed
flobaader opened this issue Jan 27, 2023 · 5 comments
Closed
Assignees
Milestone

Comments

@flobaader
Copy link

After introducing projects in v0.5.0 acorn throws this error on my GitLab CI Pipeline.

✗  ERROR:: no kubeconfig file found try adding one at $HOME/.kube/config

I created a project locally using acorn project create test and I am then using the -j option in the CI pipeline.

The pipeline:

acorn build -j test -t $IMAGE --push .
acorn run --update -j test -n $CI_ENVIRONMENT_SLUG $IMAGE

The build runs fine every time, the run command throws the No Kubeconfig exception

Workaround:
When deleting and re-creating the project, the next pipeline passes.

@flobaader
Copy link
Author

This is the debug output:

I0127 13:20:16.628789     166 loader.go:374] Config loaded from file:  /builds/selectcode/test/test.tmp/KUBECONFIG
I0127 13:20:16.629047     166 round_trippers.go:553]    in 0 milliseconds
I0127 13:20:17.183159     166 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/text/apps/branch-fix-ci 200 OK in 554 milliseconds
I0127 13:20:17.470000     166 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/infos 200 OK in 283 milliseconds
I0127 13:20:17.790771     166 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps/branch-fix-ci 200 OK in 275 milliseconds
✗  ERROR:: no kubeconfig file found try adding one at $HOME/.kube/config

What I find the most confusing is that it loads a config file in the first line, but then complains that the kube file has not been found. I suppose that this happens on the kubernetes server side or so.

@flobaader
Copy link
Author

For comparison, this is the debug log when the pipelines passes successfully:

I0128 01:37:01.133392     165 loader.go:374] Config loaded from file:  /builds/test/test/test.tmp/KUBECONFIG
I0128 01:37:01.133700     165 round_trippers.go:553]    in 0 milliseconds
I0128 01:37:01.667177     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps/branch-fix-ci 404 Not Found in 533 milliseconds
I0128 01:37:02.038917     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/infos 200 OK in 371 milliseconds
I0128 01:37:02.378961     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps/branch-fix-ci 404 Not Found in 339 milliseconds
I0128 01:37:02.907533     165 round_trippers.go:553] POST https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/images/registry.gitlab.com+test+test+test+acorn:fix-ci/details 201 Created in 527 milliseconds
I0128 01:37:03.650295     165 round_trippers.go:553] POST https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps 201 Created in 699 milliseconds
branch-fix-ci
I0128 01:37:04.073120     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps/branch-fix-ci 200 OK in 422 milliseconds
I0128 01:37:04.320595     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps?fieldSelector=metadata.name%3Dbranch-fix-ci 200 OK in 247 milliseconds
time="2023-01-28T01:37:04Z" level=debug msg="app status loop test/branch-fix-ci rev=1073256, generation=1, observed=0: newMsg=STATUS: ENDPOINTS[] HEALTHY[] UPTODATE[] , newReady=false"
STATUS: ENDPOINTS[] HEALTHY[] UPTODATE[] 
I0128 01:37:04.456391     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps?fieldSelector=metadata.name%3Dbranch-fix-ci 200 OK in 383 milliseconds
I0128 01:37:04.718031     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dbranch-fix-ci&resourceVersion=1073298&watch=true 200 OK in 261 milliseconds
I0128 01:37:04.749954     165 round_trippers.go:553] GET https://kas.gitlab.com/k8s-proxy/apis/api.acorn.io/v1/namespaces/test/apps?allowWatchBookmarks=true&fieldSelector=metadata.name%3Dbranch-fix-ci&resourceVersion=1073294&watch=true 200 OK in 428 milliseconds
time="2023-01-28T01:37:04Z" level=debug msg="app status loop test/branch-fix-ci rev=1073310, generation=1, observed=1: newMsg=STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] pending, newReady=false"
STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] pending
time="2023-01-28T01:37:04Z" level=debug msg="app status loop test/branch-fix-ci rev=1073311, generation=1, observed=1: newMsg=STATUS: ENDPOINTS[] HEALTHY[0] UPTODATE[0] pending, newReady=false"
time="2023-01-28T01:37:04Z" level=debug msg="app status loop test/branch-fix-ci rev=1073318, generation=1, observed=1: newMsg=STATUS: ENDPOINTS[] HEALTHY[0/2] UPTODATE[2] [containers: backend ContainerCreating; frontend ContainerCreating], newReady=false"
STATUS: ENDPOINTS[] HEALTHY[0/2] UPTODATE[2] [containers: backend ContainerCreating; frontend ContainerCreating]
time="2023-01-28T01:37:05Z" level=debug msg="app status loop test/branch-fix-ci rev=1073319, generation=1, observed=1: newMsg=STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[0/2] UPTODATE[2] [containers: backend ContainerCreating; frontend ContainerCreating], newReady=false"
STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[0/2] UPTODATE[2] [containers: backend ContainerCreating; frontend ContainerCreating]
time="2023-01-28T01:37:07Z" level=debug msg="app status loop test/branch-fix-ci rev=1073341, generation=1, observed=1: newMsg=STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[0/2] UPTODATE[2] [containers: backend ContainerCreating; frontend is not ready], newReady=false"
STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[0/2] UPTODATE[2] [containers: backend ContainerCreating; frontend is not ready]
time="2023-01-28T01:37:08Z" level=debug msg="app status loop test/branch-fix-ci rev=1073349, generation=1, observed=1: newMsg=STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[1/2] UPTODATE[2] [containers: backend ContainerCreating], newReady=false"
STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[1/2] UPTODATE[2] [containers: backend ContainerCreating]
time="2023-01-28T01:37:21Z" level=debug msg="app status loop test/branch-fix-ci rev=1073371, generation=1, observed=1: newMsg=STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[1/2] UPTODATE[2] [containers: backend is not ready], newReady=false"
STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[1/2] UPTODATE[2] [containers: backend is not ready]
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| STATUS: ENDPOINTS[http://backend.branch-fix-ci.test.test.io => backend:3000, http://frontend.branch-fix-ci.test.test.io => frontend:8080] HEALTHY[2] UPTODATE[2] OK |
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Cleaning up project directory and file based variables

@flobaader
Copy link
Author

Update: This also happens, when the Gitlab Kubernetes Proxy is not used and acorn has direct cluster access.
The first deployment to a project succeeds, the second deploy to a project always fails.

@sangee2004
Copy link
Contributor

KUBECONFIG set (No config file in ~/.kube/ and no config.yaml for acorn (~/.config/acorn/) )

Able to reproduce the problem in 0.5.0 (acorn version v0.5.0+7a4904c7) using the following steps:

acorn project create test3
acorn run -n test1 -j test3 .
acorn run --update -n test1 -j test3 .
` ✗  ERROR:  no kubeconfig file found try adding one at $HOME/.kube/config`

This issue is not reproducible when testing with v0.5.0-35-g0f895e7+0f895e74

acorn project create test3
acorn run -n test1 -j test3 .
acorn run --update -n test1 -j test3 . ==> succeeds. Able to update existing apps multiple times without any issues.

@sangee2004
Copy link
Contributor

@flobaader Fix for this issue will be made available in v0.5.1 release. Please reopen this issue if the issue still exists for you when testing with v0.5.1 release

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

No branches or pull requests

4 participants