我在AWS上有一个OpenShift原始(OKD)环境设置。我正在尝试部署jenkins-persistent
映像以在openshift项目中调出jenkins
吊舱。对于持久性存储,我使用基于Kubernetes documentation的Persistent Volume和Persistent Volume声明。
[root@ip-10-0-0-7 BookStore]# oc get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
jenkins 5Gi RWO Retain Bound cicd/jenkins manual 1h
jenkins-data 5Gi RWO Retain Bound cicd/jenkins-data manual 3h
[root@ip-10-0-0-7 BookStore]# oc get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
jenkins Bound jenkins 5Gi RWO manual 1h
jenkins-data Bound jenkins-data 5Gi RWO manual 3h
我基于OpenShift docs授予了访问权限。现在,每当我尝试部署该映像时,都会看到错误将Jenkins配置复制到/ var / lib / jenkins ... cp:无法创建常规文件“ /var/lib/jenkins/config.xml”:权限被拒绝
错误日志:
OPENSHIFT_JENKINS_JVM_ARCH='', CONTAINER_MEMORY_IN_MB='512', using /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.i386/jre/bin/java and /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.i386/bin/javac
Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true
mkdir: cannot create directory ‘/var/lib/jenkins/logs’: Permission denied
/usr/libexec/s2i/run: line 306: /var/lib/jenkins/image-version: Permission denied
Generating kubernetes-plugin configuration (/opt/openshift/configuration/config.xml.tpl) ...
Generating administrative monitor configuration (/opt/openshift/configuration/config.xml.tpl) ...
Generating kubernetes-plugin credentials (/var/lib/jenkins/credentials.xml.tpl) ...
Copying Jenkins configuration to /var/lib/jenkins ...
cp: cannot create regular file ‘/var/lib/jenkins/config.xml’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/config.xml.tpl’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/credentials.xml’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/credentials.xml.tpl’: Permission denied
cp: cannot create directory ‘/var/lib/jenkins/init.groovy.d’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/jenkins.CLI.xml’: Permission denied
cp: cannot create directory ‘/var/lib/jenkins/jobs’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/org.jenkinsci.main.modules.sshd.SSHD.xml’: Permission denied
cp: cannot create directory ‘/var/lib/jenkins/users’: Permission denied
mkdir: cannot create directory ‘/var/lib/jenkins/plugins’: Permission denied
Copying 104 files to /var/lib/jenkins ...
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
cp: cannot create regular file ‘/var/lib/jenkins/plugins’: Permission denied
Creating initial Jenkins 'admin' user ...
ls: cannot access /var/lib/jenkins/users: No such file or directory
ls: cannot access /var/lib/jenkins/users/: No such file or directory
sed: can't read /var/lib/jenkins/users//config.xml: No such file or directory
/usr/libexec/s2i/run: line 23: /var/lib/jenkins/password: Permission denied
touch: cannot touch ‘/var/lib/jenkins/configured’: Permission denied
Administrative monitors that contact the update center will remain active
Migrating slave image configuration to current version tag ...
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
sed: can't read /var/lib/jenkins/config.xml: No such file or directory
+ exec java -XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Xmx256m -Dfile.encoding=UTF8 -Djavamelody.displayed-counters=log,error -Duser.home=/var/lib/jenkins -Djavamelody.application-name=JENKINS -jar /usr/lib/jenkins/jenkins.war
Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true
OpenJDK Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Running from: /usr/lib/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Mar 25, 2019 6:04:16 AM org.eclipse.jetty.util.log.Log initialized
INFO: Logging initialized @971ms to org.eclipse.jetty.util.log.JavaUtilLog
Mar 25, 2019 6:04:16 AM winstone.Logger logInternal
INFO: Beginning extraction from war file
Mar 25, 2019 6:04:16 AM winstone.Logger logInternal
INFO: Jetty shutdown successfully
java.io.FileNotFoundException: /var/lib/jenkins/war/META-INF/MANIFEST.MF (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:278)
at winstone.HostConfiguration.<init>(HostConfiguration.java:81)
at winstone.HostGroup.initHost(HostGroup.java:66)
at winstone.HostGroup.<init>(HostGroup.java:45)
at winstone.Launcher.<init>(Launcher.java:169)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:344)
at Main.main(Main.java:160)
Mar 25, 2019 6:04:16 AM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.FileNotFoundException: /var/lib/jenkins/war/META-INF/MANIFEST.MF (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:278)
at winstone.HostConfiguration.<init>(HostConfiguration.java:81)
at winstone.HostGroup.initHost(HostGroup.java:66)
at winstone.HostGroup.<init>(HostGroup.java:45)
at winstone.Launcher.<init>(Launcher.java:169)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:344)
at Main.main(Main.java:160)
答案 0 :(得分:1)
最后,我找出了问题所在。这是由于创建的持久卷无法访问,因为它们存在于AWS上并且不是通过OpenShift命令创建的。在部署集群之前执行步骤1和2,然后执行其余步骤
openshift_clusterid
是唯一的,您可以使用与云形成堆栈名称相同的名称openshift_clusterid=egis
# AWS (Using API Credentials)
openshift_cloudprovider_kind=aws
openshift_cloudprovider_aws_access_key=<key>
openshift_cloudprovider_aws_secret_key=<key secret>
openshift_master_bootstrap_auto_approve=true
它将创建并安装所需的配置文件
键 = kubernetes.io/cluster/egis 价值 =拥有
volumeID
替换为ec2卷中的可用和免费卷ID
jenkins-persistent-volume.yml apiVersion: "v1"
kind: "PersistentVolume"
metadata:
name: "jenkins"
spec:
storageClassName: manual
capacity:
storage: "8Gi"
accessModes:
- "ReadWriteOnce"
awsElasticBlockStore:
fsType: "ext4"
volumeID: "<>"
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata:
name: "jenkins"
spec:
storageClassName: manual
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "8Gi"
volumeName: "jenkins"
oc create -f jenkins-persistent-volume.yml
oc create -f jenkins-persistent-volume-claim.yml