https://github.com/embik/kubectl-ephemeral
A simple kubectl plugin to launch ephemeral containers.
https://github.com/embik/kubectl-ephemeral
containers ephemeral kubectl kubectl-plugin kubernetes
Last synced: about 1 year ago
JSON representation
A simple kubectl plugin to launch ephemeral containers.
- Host: GitHub
- URL: https://github.com/embik/kubectl-ephemeral
- Owner: embik
- License: apache-2.0
- Created: 2023-04-04T16:44:54.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-16T18:33:10.000Z (about 2 years ago)
- Last Synced: 2025-03-30T17:46:04.848Z (about 1 year ago)
- Topics: containers, ephemeral, kubectl, kubectl-plugin, kubernetes
- Language: Go
- Homepage:
- Size: 61.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kubectl-ephemeral
A simple `kubectl` plugin that allows launching ephemeral containers from a YAML file (as `kubectl debug` does not expose all options).
## Installation
`kubectl-ephemeral` is currently available from [my krew index](https://github.com/embik/krew-index) or my [Homebrew tap](https://github.com/embik/homebrew-tap).
### Krew
This installation method requires [krew](https://krew.sigs.k8s.io) installed.
Add the krew index and synchronize the local copy of it:
```sh
$ kubectl krew index add embik https://github.com/embik/krew-index.git
$ kubectl krew update
```
`kubectl-ephemeral` can now be installed with the following command:
```sh
$ kubectl krew install embik/ephemeral
```
### Homebrew
Installation via [Homebrew](https://brew.sh) is possible with the following command:
```sh
$ brew install embik/tap/kubectl-ephemeral
```
### Manual
Run `make build` to get the binary `_build/kubectl-ephemeral` built. Then run:
```sh
$ chmod +x _build/kubectl-ephemeral
$ cp _build/kubectl-ephemeral /usr/local/bin/kubectl-ephemeral # or somewhere else where it will be available in your PATH
```
## Usage
`kubectl-ephemeral` requires you to provide a YAML file that describes the ephemeral container you want to launch. An example on how to launch [Delve](https://github.com/go-delve/delve) to debug a running Go application is provided in [examples/delve.yaml](./examples/delve.yaml).
The ephemeral container specification mostly aligns with normal containers, but some differences exist. In doubt, check the [corev1.EphemeralContainer](https://pkg.go.dev/k8s.io/api/core/v1#EphemeralContainer) type.
```sh
$ kubectl ephemeral -f .yaml -c
```