hashicorp / hashicorp/vault-helm
An error occurred in the init container(Operation not permitted)
- Dominant language
- Shell
- Stars
- 1.3k
- Forks
- 898
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 1
Description
**Describe the bug**
After executing the helm chart, the following error occurs when running the init container.
➜ ~ kc logs -f vault-0 -c busybox -n security
chown: /vault/logs: Operation not permitted
chown: /vault/logs: Operation not permitted
**To Reproduce**
Steps to reproduce the behavior:
1. Install chart
2. Run vault command
3. See error (vault logs, etc.)
vault-0 0/1 Init:CrashLoopBackOff 5 (60s ago) 4m13s 10.252.6.12 node01
vault-1 0/1 Init:CrashLoopBackOff 5 (65s ago) 4m11s 10.252.26.87 node02
Other useful info to include: vault pod logs, `kubectl describe statefulset vault` and `kubectl get statefulset vault -o yaml` output
Name: vault
Namespace: security
CreationTimestamp: Mon, 30 Oct 2023 16:41:15 +0900
Selector: app.kubernetes.io/instance=vault,app.kubernetes.io/name=vault,component=server
Labels: app.kubernetes.io/instance=production-retail-mgmt-security-vault
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=vault
Annotations:
Replicas: 2 desired | 2 total
Update Strategy: OnDelete
Pods Status: 0 Running / 2 Waiting / 0 Succeeded / 0 Failed
Pod Template:
Labels: app.kubernetes.io/instance=vault
app.kubernetes.io/name=vault
component=server
helm.sh/chart=vault-0.24.1
Annotations: kubectl.kubernetes.io/restartedAt: 2023-11-06T08:02:25Z
Service Account: vault
Init Containers:
busybox:
Image: docker-hub.com/finalspy/busybox-curl-jq
Port:
Host Port:
Command:
sh
-c
chown -R 1000:1000 /vault/logs
Environment:
Mounts:
/vault/logs from logs (rw)
Containers:
vault:
Image: docker-hub.com/hashicorp/vault:1.13.1-jqcurl
Ports: 8200/TCP, 8201/TCP, 8202/TCP
Host Ports: 0/TCP, 0/TCP, 0/TCP
Command:
/bin/sh
-ec
Args:
cp /vault/config/extraconfig-from-values.hcl /tmp/storageconfig.hcl;
[ -n "${HOST_IP}" ] && sed -Ei "s|HOST_IP|${HOST_IP?}|g" /tmp/storageconfig.hcl;
[ -n "${POD_IP}" ] && sed -Ei "s|POD_IP|${POD_IP?}|g" /tmp/storageconfig.hcl;
[ -n "${HOSTNAME}" ] && sed -Ei "s|HOSTNAME|${HOSTNAME?}|g" /tmp/storageconfig.hcl;
[ -n "${API_ADDR}" ] && sed -Ei "s|API_ADDR|${API_ADDR?}|g" /tmp/storageconfig.hcl;
[ -n "${TRANSIT_ADDR}" ] && sed -Ei "s|TRANSIT_ADDR|${TRANSIT_ADDR?}|g" /tmp/storageconfig.hcl;
[ -n "${RAFT_ADDR}" ] && sed -Ei "s|RAFT_ADDR|${RAFT_ADDR?}|g" /tmp/storageconfig.hcl;
/usr/local/bin/docker-entrypoint.sh vault server -config=/tmp/storageconfig.hcl
Limits:
cpu: 250m
memory: 256Mi
Requests:
cpu: 250m
memory: 256Mi
Environment:
HOST_IP: (v1:status.hostIP)
POD_IP: (v1:status.podIP)
VAULT_K8S_POD_NAME: (v1:metadata.name)
VAULT_K8S_NAMESPACE: (v1:metadata.namespace)
VAULT_ADDR: http://127.0.0.1:8200
VAULT_API_ADDR: http://$(POD_IP):8200
SKIP_CHOWN: true
SKIP_SETCAP: true
HOSTNAME: (v1:metadata.name)
VAULT_CLUSTER_ADDR: https://$(HOSTNAME).vault-internal:8201
HOME: /home/vault
VAULT_LOG_LEVEL: info
VAULT_LOG_FORMAT: json
Mounts:
/etc/localtime from localtime (ro)
/etc/timezone from timezone (ro)
/home/vault from home (rw)
/vault/config from config (rw)
/vault/file from script (rw)
/vault/logs from logs (rw)
Volumes:
config:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: vault-config
Optional: false
logs:
Type: HostPath (bare host directory volume)
Path: /home/logs/security/vault
HostPathType:
home:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit:
timezone:
Type: HostPath (bare host directory volume)
Path: /etc/timezone
HostPathType:
localtime:
Type: HostPath (bare host directory volume)
Path: /etc/localtime
HostPathType:
script:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: vault-auto-unseal
Optional: false
Volume Claims:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 8m6s (x24 over 7d3h) statefulset-controller create Pod vault-0 in StatefulSet vault successful
Normal SuccessfulCreate 8m4s (x24 over 7d3h) statefulset-controller create Pod vault-1 in StatefulSet vault successful
**Expected behavior**
A clear and concise description of what you expected to happen.
**Environment**
* Kubernetes version:
* Distribution or cloud vendor (OpenShift, EKS, GKE, AKS, etc.):
* Other configuration options or runtime services (istio, etc.):
* vault-helm version:
apiVersion: v2
name: vault
version: 0.24.1
appVersion: 1.13.1
Chart values:
```yaml
values.yaml
server:
# Configure the logging format for the Vault server.
# Supported log formats include: standard, json
logFormat: "json"
extraInitContainers:
- name: busybox
image: "docker-hub-custom.com/finalspy/busybox-curl-jq"
command: [ "sh", "-c", "chown -R 1000:1000 /vault/logs" ]
volumeMounts:
- name: logs
mountPath: /vault/logs
```
**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
Start with the chart's server.extraInitContainers configuration and the logs HostPath volume described in the issue. Reproduce the installation with the provided values, then inspect the busybox init-container logs and rendered StatefulSet. Done should mean the Vault pods complete initialization without the reported chown permission error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- helm, kubernetes, shell
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100