我正在尝试运行gitea 1.8.3,现在有一种习惯,想将生成的JWT令牌写入其自己的app.ini文件中。以前,可以从ConfigMap挂载app.ini文件为只读文件。现在,我需要以某种方式填充一些数据到app.ini文件中,同时还要让该应用程序写入该文件中。
我试图让initContainer写出安装在主应用程序中的配置。在here中对此进行了说明。当我使用minishift尝试该示例时,它告诉我由于安全约束而无法安装hostPath。我不想放宽安全性,因此我尝试将配置放入PVC。这是脚本:
public function authenticate($request)
{
return \Auth::guard()->attempt([
'email' => $request->email,
'password' => $request->password,
],
$request->filled('remember')
);
}
这很好,但是当我使用minishift Web控制台进入Pod中的终端并运行#!/bin/bash
cat | oc create -f - <<EOF
---
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata:
name: "config-data-claim"
spec:
accessModes:
- "ReadWriteMany"
resources:
requests:
storage: "1Gi"
---
apiVersion: v1
kind: Pod
metadata:
name: my-app
spec:
containers:
- name: realworld
image: docker.io/simonmassey/react-redux-realworld:v0.0.2
env:
- name: API_ROOT
value: https://conduit.productionready.io/api
volumeMounts:
- mountPath: /data
name: config-data-claim
initContainers:
- name: config-data
image: busybox
command: ["echo","-n","{'address':'10.0.1.192:2379/db'}", ">","/data/config"]
volumeMounts:
- mountPath: /data
name: config-data-claim
volumes:
- name: config-data-claim
persistentVolumeClaim:
claimName: config-data-claim
EOF
pvc时,它是空的。控制台显示initContainer已成功运行。
为什么initContainer不会填充pvc文件夹ls -al /data
?
我正在跑步:
/data
该服务器是minishift运行的opensheft 3.11,其开始于:
$ oc version
Client Version: version.Info{Major:"4", Minor:"1+", GitVersion:"v4.1.0+b4261e0", GitCommit:"b4261e07ed", GitTreeState:"clean", BuildDate:"2019-07-06T03:16:01Z", GoVersion:"go1.12.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2019-08-30T20:25:39Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}