Open rawipfel opened 6 years ago
@rawipfel Can you check if in your example the Vault Deployment example
has been created by the vault-operator. If yes then it's an issue with the restricted
SCC rejecting the Vault Deployment pods.
Currently the vault-operator configures Vault containers with the IPC_LOCK
capability.
https://github.com/coreos/vault-operator/blob/master/pkg/util/k8sutil/vault.go#L167-L173
The restricted
SCC does not allow pods with this capability. If you check the Deployment status for the example
Vault deployment you should be able to see the pods being rejected.
Can you try updating the restricted
SCC to grant it the IPC_LOCK
capability and then try again:
kind: SecurityContextConstraints
apiVersion: v1
metadata:
name: restricted
...
allowedCapabilities:
- IPC_LOCK
...
However this is just a work around since changing the restricted
SCC is not a good idea.
A more proper solution to this issue is to either:
a) Remove the need for IPC_LOCK https://github.com/coreos/vault-operator/issues/311 but that needs more thought.
b) Be able to configure service accounts for the vault pods via the the VaultService CR's spec.PodPolicy
so that they can use a dedicated service account and SCC that allows the IPC_LOCK
capability.
Thanks @hasbro17 that was the problem, the Vault Deployment example
wasn't working:
Roberts-MacBook-Pro:Desktop rwipfel$ kubectl get pod
NAME READY STATUS RESTARTS AGE
etcd-operator-7bf6b58cdf-rs9vf 3/3 Running 0 12m
example-etcd-2cvxzp5hzk 1/1 Running 0 11m
example-etcd-89smzphhnl 1/1 Running 0 11m
example-etcd-w8v4mdjcxh 1/1 Running 0 12m
vault-operator-67d5846657-82bwp 1/1 Running 0 12m
Roberts-MacBook-Pro:Desktop rwipfel$ kubectl get deploy
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
etcd-operator 1 1 1 1 12m
example 2 0 0 0 11m
vault-operator 1 1 1 1 12m
This is my entire startup script, is now working, after allowing IPC_LOCK:
Roberts-MacBook-Pro:Desktop rwipfel$ cat runVault.sh
set -x
oc login -u system:admin
oc patch scc restricted -p '{"fsGroup":{"type":"RunAsAny"}}'
oc patch scc restricted -p '{"runAsUser":{"type":"RunAsAny"}}'
oc patch scc restricted -p '{"allowedCapabilities":["IPC_LOCK"]}'
cd ~/git/etcd-operator/
example/rbac/create_role.sh --namespace=myproject
cd ~/git/vault-operator/
sed -e 's/<namespace>/myproject/g' \
-e 's/<service-account>/default/g' \
example/rbac-template.yaml > example/rbac.yaml
kubectl create -f example/rbac.yaml
kubectl create -f example/etcd_crds.yaml
kubectl create -f example/etcd-operator-deploy.yaml
kubectl create -f example/vault_crd.yaml
kubectl create -f example/deployment.yaml
sleep 5 && kubectl get deploy
kubectl create -f example/example_vault.yaml
sleep 5 && kubectl get pods
Many thanks, It's working now :)
Roberts-MacBook-Pro:Desktop rwipfel$ kubectl get pods
NAME READY STATUS RESTARTS AGE
etcd-operator-7bf6b58cdf-xf6xp 3/3 Running 0 2m
example-5f68dbcdf4-29jqf 1/2 Running 0 55s
example-5f68dbcdf4-l9glp 1/2 Running 0 55s
example-etcd-2vcphl4hkr 1/1 Running 0 1m
example-etcd-7wn782cn29 1/1 Running 0 1m
example-etcd-cb8kqnjrpz 1/1 Running 0 1m
vault-operator-67d5846657-mhq6q 1/1 Running 0 1m
I guess #311 is a question of demo/dev/eval vs. production deployment. It seems reasonable to document the workaround for demo/dev/eval, but require IPC_LOCK by default for secure production deployments. Agree that changing the restricted
SCC isn't a good idea, and maybe there will be other reasons for configurable service accounts in future...
Hi @hasbro17, I will submit a PR to update the README with a description of the above workaround, if that's an acceptable way to resolve this, please lmk...
Hi, I'm trying out the vault+etcd-operator on a Macbook running Docker 18.03.1-ce-mac65 (24312) and Openshift origin v3.9.0. Starting from a clean installation and master branch of vault-operator and etcd-operator repos:
There isn't anything obviously wrong in logs. The etcd cluster is running properly.
The vault-operator shows this:
I'm not sure where to look next?
(As a guess I tried creating custom TLS certificates per https://github.com/coreos/vault-operator/blob/master/doc/user/tls_setup.md but that made no difference)
I'd be grateful for any help, and willing to contribute once I learn more about how to operate these operators :)