mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 11:57:44 +08:00
When the `/container-init.d` directory is mounted from a secret in k8s, the file type could be a symbolic link not a regular file.
Steps to reproduce:
Create init file
```bash
mkdir ipfs-container-init-d
echo "ipfs config Routing.Type dhtserver" > ipfs-container-init-d/01_init.sh
```
Create this kustomization.yaml file:
```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
- name: ipfs-container-init-d
files:
- ipfs-container-init-d/01_init.sh
resources:
- k8s.yaml
```
Create a StatefulSet with the secret volume mount:
```yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ipfs
spec:
selector:
matchLabels:
app: ipfs
replicas: 1
template:
metadata:
labels:
app: ipfs
spec:
containers:
- name: kubo
image: ipfs/kubo:v0.38.2 # https://github.com/ipfs/kubo/releases/tag/v0.38.2
ports:
- containerPort: 4001
protocol: TCP
- containerPort: 4001
protocol: UDP
- containerPort: 5001
- containerPort: 8080
volumeMounts:
- name: ipfs-container-init-d
mountPath: /container-init.d
volumes:
- name: ipfs-container-init-d
configMap:
name: ipfs-container-init-d
```
Apply with `kubectl apply -k .`
Using `kubectl logs` observe the init script is NOT loaded unless this fix is applied.
|
||
|---|---|---|
| .. | ||
| archive-branches.sh | ||
| container_daemon | ||
| container_init_run | ||
| dist_get | ||
| gencmdref | ||
| get-docker-tags.sh | ||
| graphmd | ||
| ipns-republish | ||
| maketarball.sh | ||
| mkreleaselog | ||
| push-docker-tags.sh | ||
| Rules.mk | ||
| test-go-build-platforms | ||
| test-go-fmt | ||