You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: skills/piggy-webhooks.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,24 @@ triggers:
6
6
- piggysec
7
7
- piggy-env
8
8
- piggy-webhooks
9
-
- install-piggy-env
10
9
- PIGGY_ALLOWED_SA
11
10
- secrets injection
12
11
- secret manager
12
+
- decision not allowed
13
+
- install-piggy-env
14
+
- piggysec.com
15
+
- piggy-initial-delay
16
+
- piggy-enforce-integrity
17
+
- piggy-ignore-no-env
18
+
- piggy-number-of-retry
19
+
- piggy-address
20
+
- piggy-aws-secret-name
13
21
---
14
22
15
23
Piggy is a Kubernetes mutating admission webhook that injects AWS Secrets Manager secrets into pod environments via a `piggy-env` init container. Follow this step-by-step diagnostic process.
16
24
25
+
> **Note:** Piggy is configured entirely through **Kubernetes annotations** and **environment variables** on the `piggy-webhooks` deployment. There are no CRDs, no PiggyPolicy resources. All configuration is annotation-based.
26
+
17
27
## How Piggy Works (Context)
18
28
19
29
When a pod is created:
@@ -22,7 +32,8 @@ When a pod is created:
22
32
2. Piggy Webhooks injects an `install-piggy-env` init container into the pod.
23
33
3. At runtime, `piggy-env` starts and contacts Piggy Webhooks over TLS, sending the pod's service account token, pod name, and a command signature (SHA256).
24
34
4. Piggy Webhooks validates credentials via the Kubernetes Token Review API, exchanges the service account token for temporary AWS credentials via STS, then fetches secrets from AWS Secrets Manager.
25
-
5.`piggy-env` receives the secrets and replaces any environment variable prefixed with `piggy:` with the real value.
35
+
5. Piggy Webhooks checks the `PIGGY_ALLOWED_SA` field in the secret. If the pod's service account (`<namespace>:<service-account>`) is listed there, the request is authorized and the secret is returned. If the service account is **not** listed, Piggy Webhooks rejects the request and logs `"decision not allowed"`. The pod (`piggy-env`) receives no secret and retries according to `piggysec.com/piggy-number-of-retry`; retry attempts appear in the pod logs.
36
+
6.`piggy-env` receives the secrets and replaces any environment variable prefixed with `piggy:` with the real value.
26
37
27
38
## Diagnostic Steps
28
39
@@ -32,11 +43,17 @@ When a pod is created:
32
43
kubectl describe pod <pod-name> -n <namespace> --context <ctx>
33
44
```
34
45
46
+
A pod has been mutated by Piggy if **any** of the following are present:
47
+
48
+
- The `install-piggy-env` init container appears in `Init Containers:`
49
+
- The annotation `piggysec.com/piggy-uid` is set on the pod
50
+
- The environment variable `PIGGY_UID` is injected into the application container
51
+
35
52
Look for the `install-piggy-env` init container in `Init Containers:`:
- Non-zero `Exit Code` or `State: Waiting` — init container failed; see Troubleshooting below.
39
-
- No `install-piggy-env` container at all — pod was never mutated; see "Pod Not Mutated" below.
56
+
- No `install-piggy-env` container, no `piggysec.com/piggy-uid` annotation, and no `PIGGY_UID` env var — pod was never mutated; see "Pod Not Mutated" below.
40
57
41
58
Also check that your application container's `Command` starts with `/piggy/piggy-env`:
0 commit comments