Skip to content

Specify kubeconfig file path for "trivy k8s" command #2522

Closed
@pcgeek86

Description

@pcgeek86

Description

When you run the trivy k8s command, there is no option to specify an alternative kubeconfig file path.
By default, the kubeconfig file resides in $HOME/.kube/config.
However, users of Kubernetes often need to specify a different path, using a parameter like --kubeconfig on the kubectl command.

If you don't have the kubeconfig in the default filesystem path, then the error below is received.

root@trivy:~# trivy k8s --report summary cluster
2022-07-15T08:25:43.301Z        FATAL   get k8s artifacts error: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused

Solution

Please add --kubeconfig as an argument / parameter for the trivy k8s command.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.target/kubernetesIssues relating to kubernetes cluster scanning

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions