> For the complete documentation index, see [llms.txt](https://hex108.gitbook.io/kubernetes-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hex108.gitbook.io/kubernetes-notes/kuo-zhan-kubernetes/kubectl-plugin.md).

# Kubectl plugin

使用kubectl plugin可以很方便地扩展kubectl命令，比如：可以加一个kubectl set-ns命令用于设置当前的namespace。关于plugin的介绍可见[Extend kubectl with plugins](https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/)。

如果你要使用很多个plugin，这时候就可以使用plugin管理工具[krew](https://github.com/GoogleContainerTools/krew)了。

```
kubectl krew search               # show all plugins
kubectl krew install view-secret  # install a plugin named "view-secret"
kubectl view-secret               # use the plugin
kubectl krew upgrade              # upgrade installed plugins
kubectl krew remove view-secret   # uninstall a plugin
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hex108.gitbook.io/kubernetes-notes/kuo-zhan-kubernetes/kubectl-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
