我正在尝试在openshift online v3 pro上运行 SELECT a.id as AdhocID,
r.label as AdhocLabel,
a.reportDataSource as AdhocDataSourceID,
t.AdhocDataSourceLabel
FROM (SELECT id as AdhocDataSourceID,
label as AdhocDataSourceLabel
FROM public.jiresource
) as t
INNER JOIN public.jiadhocdataview a ON a.reportDataSource = t.AdhocDataSourceID
INNER JOIN public.jiresource r ON a.id = r.id
。如果我只是使用Web控制台从图像创建一个新的应用程序,它只分配512Mi,它会死于OOM。它确实被创建了并且在内存不足之前记录了很多java输出。使用Web控制台时,似乎没有办法在图像上设置内存。当我尝试编辑pod的yaml时,它不允许我编辑内存限制。
阅读docs about memory limits它表明我可以运行:
sonatype/nexus3
然后它甚至没有开始。它死于:
{kubelet ip-172-31-59-148.ec2.internal}错误:来自的错误响应 守护进程:{“message”:“创建 c30deb38b3c26252bf1218cc898fbf1c68d8fc14e840076710c211d58ed87a59: MKDIR 在/ var / lib中/泊坞窗/卷/ c30deb38b3c26252bf1218cc898fbf1c68d8fc14e840076710c211d58ed87a59: 许可被拒绝“}
来自oc run nexus333 --image=sonatype/nexus3 --limits=memory=750Mi
的更多信息:
oc get events
我不确定为什么如果我使用网络控制台我无法分配更多内存。我不确定为什么用FIRSTSEEN LASTSEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE
16m 16m 1 nexus333-1-deploy Pod Normal Scheduled {default-scheduler } Successfully assigned nexus333-1-deploy to ip-172-31-50-97.ec2.internal
16m 16m 1 nexus333-1-deploy Pod spec.containers{deployment} Normal Pulling {kubelet ip-172-31-50-97.ec2.internal} pulling image "registry.reg-aws.openshift.com:443/openshift3/ose-deployer:v3.6.173.0.21"
16m 16m 1 nexus333-1-deploy Pod spec.containers{deployment} Normal Pulled {kubelet ip-172-31-50-97.ec2.internal} Successfully pulled image "registry.reg-aws.openshift.com:443/openshift3/ose-deployer:v3.6.173.0.21"
15m 15m 1 nexus333-1-deploy Pod spec.containers{deployment} Normal Created {kubelet ip-172-31-50-97.ec2.internal} Created container
15m 15m 1 nexus333-1-deploy Pod spec.containers{deployment} Normal Started {kubelet ip-172-31-50-97.ec2.internal} Started container
15m 15m 1 nexus333-1-rftvd Pod Normal Scheduled {default-scheduler } Successfully assigned nexus333-1-rftvd to ip-172-31-59-148.ec2.internal
15m 14m 7 nexus333-1-rftvd Pod spec.containers{nexus333} Normal Pulling {kubelet ip-172-31-59-148.ec2.internal} pulling image "sonatype/nexus3"
15m 10m 19 nexus333-1-rftvd Pod spec.containers{nexus333} Normal Pulled {kubelet ip-172-31-59-148.ec2.internal} Successfully pulled image "sonatype/nexus3"
15m 15m 1 nexus333-1-rftvd Pod spec.containers{nexus333} Warning Failed {kubelet ip-172-31-59-148.ec2.internal} Error: Error response from daemon: {"message":"create 3aa35201bdf81d09ef4b09bba1fc843b97d0339acfef0c30cecaa1fbb6207321: mkdir /var/lib/docker/volumes/3aa35201bdf81d09ef4b09bba1fc843b97d0339acfef0c30cecaa1fbb6207321: permission denied"}
运行它会导致mkdir错误。谁能告诉我如何在openshift online pro上运行oc run
?
答案 0 :(得分:0)
好的mkdir /var/lib/docker/volumes/
权限被拒绝似乎是图片需要/nexus-data
挂载而且被拒绝了。我通过Web控制台(使用OOM处理)进行部署,但是创建的pod的编辑yaml可以看到生成的卷装入。
使用cat nexus3_pod.ephemeral.yaml | oc create -f -
使用以下yaml创建具有卷装入和显式内存设置的图像,容器现在将启动:
apiVersion: "v1"
kind: "Pod"
metadata:
name: "nexus3"
labels:
name: "nexus3"
spec:
containers:
-
name: "nexus3"
resources:
requests:
memory: "1200Mi"
limits:
memory: "1200Mi"
image: "sonatype/nexus3"
ports:
-
containerPort: 8081
name: "nexus3"
volumeMounts:
- mountPath: /nexus-data
name: nexus3-1
volumes:
- emptyDir: {}
name: nexus3-1
备注
-Xmx1200m
,如sonatype/docker-nexus3所述。因此,如果您分配的内存小于1200Mi,当堆超过限制时,它将与OOM一起崩溃。您也可以将requested和max设置为最大堆边。 emptyDir
文件在崩溃重启和内存更改之间徘徊(我认为这是记录的行为)。我不得不重新创建一个具有不同名称的pod以获得干净的emptyDir并分配1200Mi的内存以使其全部启动。 答案 1 :(得分:0)
您可能还想继续使用OpenShift文档中的教程https://docs.openshift.com/online/dev_guide/app_tutorials/maven_tutorial.html
我已经成功在OpenShift Online Pro中部署了这个
答案 2 :(得分:0)
查看文档,我看到它是Java VM解决方案。
使用Java 8时,仅使用以下两个运行时Java VM选项,可以显着提高内存使用率:
...“ -XX:+ UnlockExperimentalVMOptions”,“-XX:+ UseCGroupMemoryLimitForHeap” ...
我刚刚部署了消耗超过650 MB RAM的容器(Spring Boot JAR)。仅使用这两个(新)选项,RAM消耗就减少到仅270 MB !!!
因此,使用这2个运行时设置,所有OOM都被远远甩在了后面!享受吧!