kubectl-ai
kubectl-ai copied to clipboard
~/.kube/config is not used ?
I'm using Oracle Cloud Kubernetes (OKI). OKI can be accessed with oci cli command.
https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengdownloadkubeconfigfile.htm
In such a configuration, kubectl-ai apparently does not execute the command. kubectl-ai reply nothing for kubectl commands.
+1
I am wondering if this was due to bug that got fixed in this PR https://github.com/GoogleCloudPlatform/kubectl-ai/pull/126
@mattn can you try with the latest release ?
Unfortunately, does not work correctly. I guess kubectl-ai does not spawn kubectl. This use kubernetes APIs instead of executing kubectl, right?
kubectl-ai uses kubernetes APIs here.
https://github.com/GoogleCloudPlatform/kubectl-ai/blob/7b155dc6b791a3c0d20593d867cddafcbc4606a0/kubectl-utils/pkg/kube/client.go#L44-L60
Confirming that kubectl-ai invokes kubectl command under the hood. It doesn't call the kubernetes APIs. kubectl-utils (the snippet above) is being used for different purpose (k8s-bench).
About kubeconfig:
- If not specified, it will default to
~/.kube/config - you can specify
--kubeconfigand point to path - env variable KUBECONFIG.
I tried the following in my setup and seems to be working fine:
$ ./kubectl-ai --kubeconfig ~/.kube/config --quiet "list pods in the cluster"
Running: kubectl get pods
The following pods are running in the cluster:
• nginx-5869d7778c-fttkf
• nginx-5869d7778c-tmj4n
• nginx-5869d7778c-tqhfw
• nginx-5869d7778c-xkd8f
$ ./kubectl-ai --quiet "list pods in the cluster"
Running: kubectl get pods
The following pods are running in your cluster:
• nginx-5869d7778c-fttkf
• nginx-5869d7778c-tmj4n
• nginx-5869d7778c-tqhfw
• nginx-5869d7778c-xkd8f
All pods are in a Running state and have 1/1 ready containers. No pods have
been restarted. The age of the pods varies from 16 hours to 4 days and 17 hours.
@mattn can you share what error you are getting.
kubectl-ai --kubeconfig ~/.kube/config --quiet "list pods in the cluster"
Running: kubectl get pods
Running: kubectl get pods --all-namespaces
There are no pods in your cluster. Is there anything else I can help you with?
That is strange.
kubectl-ai logs by default in /tmp/kubectl-ai.log. It also logs detailed trace in /tmp/kubectl-ai-trace.txt (if using latest release) else trace.txt (directory where it was invoked).
Those two files may contain information about what really happened. Would be great if you can take a look at those two files and see if anything interesting.