plugins: add a plugin to start an alpine:latest container in current context/namespace (#3265)

* plugins: add a plugin to start an alpine:latest container in current context/namespace

* start-alpine: Update plugins README

* add: plugins root key to address lint issues, kubectl annotation for default container

* removed label that disables istio's sidecar injection pattern

---------

Co-authored-by: Simon Bordeyne <simon.bordeyne@happn.fr>
Co-authored-by: Fernand Galiana <fernand.galiana@gmail.com>
mine
Simon Bordeyne 2025-04-16 16:20:20 +02:00 committed by GitHub
parent 8807dc0ef8
commit 7deb202c2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Following is an example of some plugin files in this directory. Other files are
| szero.yaml | Temporarily scale down/up all deployments, statefulsets, and daemonsets | namespaces | Shift-d/u | [szero](https://github.com/jadolg/szero) |
| trace-dns.yaml | Trace DNS resolution using Inspektor Gadget (4) | containers/pods/nodes | Shift-d | |
| vector-dev-top.yaml | Run `vector top` in vector.dev container | pods/container | h | [vector top](https://vector.dev/highlights/2020-12-23-vector-top/) |
| start-alpine.yaml | Starts a deployment for the `alpine:latest` docker image in the current namespace/context | deployments/pods | Ctrl-T | |
[1]: https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/#ephemeral-container
[2]: https://github.com/nicolaka/netshoot

14
plugins/start-alpine.yaml Normal file
View File

@ -0,0 +1,14 @@
plugins:
start-alpine-pod:
shortCut: Ctrl-T
confirm: true
description: "Start an alpine:latest pod in current context/namespace"
scopes:
- pods
- deployments
command: bash
background: true
args:
- -c
- |
echo '{"apiVersion": "apps/v1", "kind": "Deployment", "metadata": {"name": "alpine", "labels": {"app": "alpine", "debug": "1"}}, "spec": {"selector": {"matchLabels": {"app": "alpine"}}, "replicas": 1, "template": {"metadata": {"labels": {"app": "alpine", "debug": "1"}, "annotations": {"kubectl.kubernetes.io/default-container": "alpine"}}, "spec": {"containers": [{"name": "alpine", "image": "alpine:latest", "imagePullPolicy": "Always", "securityContext": {"runAsUser": 0, "runAsGroup": 0}, "stdin": true, "tty": true, "stdinOnce": true, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File", "resources": {"requests": {"cpu": "100m", "memory": "100Mi"}, "limits": {"cpu": "100m", "memory": "100Mi"}}}], "restartPolicy": "Always"}}}}' | kubectl apply -f - --context $CONTEXT --namespace $NAMESPACE