I am trying to run Vault as a StatefulSet on Kubernetes.
I have a working consul cluster based on this: https://github.com/kelseyhightower/consul-on-kubernetes
My sts file for Vault looks like this:
kind: StatefulSet
metadata:
name: vault
spec:
serviceName: vault
replicas: 2
template:
metadata:
labels:
app: vault
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- vault
topologyKey: kubernetes.io/hostname
containers:
- name: vault
image: "vault:0.9.0"
ports:
- containerPort: 8200
name: http
- containerPort: 8201
name: backend
args:
- "server -config=/vault/config/vault-server.json"
securityContext:
capabilities:
add:
- IPC_LOCK
volumeMounts:
- name: config
mountPath: /vault/config
- name: tls
mountPath: /etc/tls
volumes:
- name: config
configMap:
name: vault
- name: tls
secret:
secretName: vault
My config file looks like this
{
"disable_mlock": true,
"listener": [
{
"tcp": {
"tls_disable": true
}
}
],
"storage": {
"consul": {
"address": "consul.default.svc.cluster.local:8500",
"path": "vault",
"token": "7e21f292-e7e7-f879-210c-4af2ae483cac"
}
}
}
When I apply the StatefulSet, I get a bind error
Error initializing listener of type tcp: listen tcp 127.0.0.1:8200: bind: address already in use
I have tried adding a listener with 127.0.0.1 and 0.0.0.0 with different ports. The pod is reading the config file because I was getting TLS warnings until I disabled.
Any ideas on what is bound to localhost on the pod? Any troubleshooting help would be appreciated
docker run -p 8200:8200 -p 8201:8201 vault:0.9.0 server -config=/and/so/forthlocally, does it start up as you would expect? - mdaniel"disable_mlock": true,when the container is explicitly grantedIPC_LOCK(but I doubt that has anything at all to do with your bind question) - mdaniel