Open advanceboy opened 2 months ago
Here is a workaround that has been identified:
$ sudo ln -s /snap/microk8s/current/usr/lib/git-core /usr/lib/git-core
$ microk8s kubectl apply -k .
configmap/the-map created
service/the-service created
deployment.apps/the-deployment created
However, it relies on the absence of git on the host OS, making it an impractical solution.
This workaround is better because it has less impact on the host OS:
$ cat << EOF > ./kustomization.yaml
resources:
- https://github.com/kubernetes-sigs/kustomize//examples/helloWorld/?timeout=120&ref=v3.3.1
EOF
$ GIT_EXEC_PATH=/snap/microk8s/current/usr/lib/git-core/ microk8s kubectl apply -k .
configmap/the-map created
service/the-service created
deployment.apps/the-deployment created
I have added a proposed fix to the issue description.
Additionally, similar issues have been reported in #1260 and #4453.
Summary
When installing microk8s via snap,
kubectl
encounters a fatal error when specifying a remote directory as a resource inkustomization.yaml
.Channel: latest/stable
Version: v1.29.0
OS: Ubuntu 24.04 LTS (minimized)
What Should Happen Instead?
No errors should occur, and kubectl and helm commands should succeed.
Reproduction Steps
Expected Result:
Actual Result:
Introspection Report
inspection-report-20240618_154427.tar.gz
Can you suggest a fix?
The issue seems to be caused by
the absence ofgit-remote-https
$SNAP/usr/lib/git-core/git-remote-https
not being referenced in the git package included with snap.To resolve this, it seems possible to define the environment variable in the
snapcraft.yaml
file.https://github.com/canonical/microk8s/blob/b25957fe365f9382ff5626c381a1f8093beee868/snap/snapcraft.yaml#L15-L20
Let's try this.
I'm not familiar with Snapcraft, so I'm unsure if this is the most appropriate fix.
note
If git is installed on the host OS, the error message changes, suggesting it references the host OS's
git-remote-https
.Using a remote file instead of a remote directory works as expected.