-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hi! I'm asking for some help with debugging why secret injection is not working.
Here's my setup:
- 1Password Connect Server deployed in k8s using helm chart, confirmed it's working fine with 1Password Kubernetes Operator
- Installed secrets injector with a helm chart:
helm install onepassword-injector 1password/secrets-injector -n onepassword
- Enabled injection for the namespace:
kubectl label namespace teama secrets-injection=enabled
- Created k8s secret with 1Pass token and deployment like:
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-example
namespace: teama
spec:
selector:
matchLabels:
app: app-example
template:
metadata:
annotations:
operator.1password.io/inject: "app-example1"
labels:
app: app-example
spec:
containers:
- name: app-example1
image: nginx:latest
command: ["nginx"]
args: ["-g", "daemon off;"]
ports:
- containerPort: 8080
# This app will have the secrets injected using Connect.
env:
- name: OP_CONNECT_HOST
value: http://onepassword-connect.onepassword.svc.cluster.local:8080
- name: OP_CONNECT_TOKEN
valueFrom:
secretKeyRef:
name: onepassword-token
key: token
- name: USERNAME
value: op://<vault-id>/<item-id>/username
- name: PASSWORD
value: op://<vault-id>/<item-id>/password
- Secrets injector pod reported no errors:
I1212 13:39:58.439850 1 webhook.go:481] Ready to write response ...
I1212 13:40:51.469907 1 webhook.go:180] Checking if secret injection is needed for /v1, Kind=Pod at namespace teama
I1212 13:40:51.469929 1 webhook.go:98] Pod at namespace . Secret injection status: Secret Injection Enabled:true
I1212 13:40:51.469939 1 webhook.go:313] OP_SERVICE_ACCOUNT_TOKEN not provided
I1212 13:40:51.469943 1 webhook.go:345] OP CLI will be used with Connect
I1212 13:40:51.470001 1 webhook.go:287] AdmissionResponse: patch=[{"op":"add","path":"/spec/containers/0/volumeMounts","value":[{"name":"op-bin","readOnly":true,"mountPath":"/op/bin/"}]},{"op":"replace","path":"/spec/containers/0/command","value":["/op/bin/op","run","--","nginx"]},{"op":"add","path":"/spec/containers/0/env/-","value":{"name":"OP_INTEGRATION_NAME","value":"1Password Kubernetes Webhook"}},{"op":"add","path":"/spec/containers/0/env/-","value":{"name":"OP_INTEGRATION_ID","value":"K8W"}},{"op":"add","path":"/spec/containers/0/env/-","value":{"name":"OP_INTEGRATION_BUILDNUMBER","value":"1000001"}},{"op":"add","path":"/spec/volumes/-","value":{"name":"op-bin","emptyDir":{"medium":"Memory"}}},{"op":"add","path":"/spec/initContainers","value":[{"name":"copy-op-bin","image":"1password/op:2","command":["sh","-c","cp /usr/local/bin/op /op/bin/"],"resources":{},"volumeMounts":[{"name":"op-bin","mountPath":"/op/bin/"}],"imagePullPolicy":"IfNotPresent"}]},{"op":"add","path":"/metadata/annotations","value":{"operator.1password.io/status":"injected"}}]
I1212 13:40:51.470017 1 webhook.go:481] Ready to write response ...
- Application pod reported no errors:
2022/12/12 13:36:19 [notice] 15#15: using the "epoll" event method
2022/12/12 13:36:19 [notice] 15#15: nginx/1.23.2
2022/12/12 13:36:19 [notice] 15#15: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2022/12/12 13:36:19 [notice] 15#15: OS: Linux 5.4.209-116.363.amzn2.x86_64
2022/12/12 13:36:19 [notice] 15#15: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/12/12 13:36:19 [notice] 15#15: start worker processes
2022/12/12 13:36:19 [notice] 15#15: start worker process 19
2022/12/12 13:36:19 [notice] 15#15: start worker process 20
My understanding is that data from 1Password Item should be injected to application pod env vars so I'm checking with:
kubectl -n teama exec \
$(kubectl -n teama get pod -l app=app-example -o jsonpath="{.items[0].metadata.name}") \
--container app-example1 -- printenv USERNAME PASSWORD
but the output is:
op://<vault-id>/<item-id>/username
op://<vault-id>/<item-id>/password
I'd expect to see it replaced with actual username and password from the Vault Item.
Confirmed item is created in 1Password:
op item get <vault-id> --vault <item-id> --fields label=username,label=password
Are you able to help me with this?
Metadata
Metadata
Assignees
Labels
No labels