简体   繁体   English

无法在K8s中设置kernel.core_pattern

[英]Unable to set kernel.core_pattern in K8s

I am trying to modify the kernel.core_pattern but I am unable to modify it as it is Read-Only.我正在尝试修改 kernel.core_pattern 但我无法修改它,因为它是只读的。

I have tried:我试过了:

> echo 'kernel.core_pattern=/tmp/core-%e.%p.%h.%t' >> /etc/sysctl.conf

> Reload sysctl: sysctl --system
Applying /etc/sysctl.conf ... sysctl: setting key "kernel.core_pattern": Read-only file system cat /proc/sys/kernel/core_pattern 

I am no able to add it to the pod yaml either:我也无法将它添加到 pod yaml 中:

spec:
  securityContext:
    sysctls:
    - name: kernel.core_pattern
      value: "/tmp/core-%e.%p.%h.%t"

I keep getting this: SysctlForbidden我不断得到这个: SysctlForbidden

I created a PodSecurityPolicy as well:我还创建了一个 PodSecurityPolicy:

apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: sysctl-psp
spec:
  privileged: false  # Don't allow privileged pods!
  # The rest fills in some required fields.
  seLinux:
    rule: RunAsAny
  supplementalGroups:
    rule: RunAsAny
  runAsUser:
    rule: RunAsAny
  fsGroup:
    rule: RunAsAny
  allowedUnsafeSysctls:
  - kernel.*

Still no luck.仍然没有运气。

Any suggestions?有什么建议么?

I was able to edit the kernel.core_pattern on the nodes in the cluster and that was reflected in the pods as well.我能够在集群中的节点上编辑 kernel.core_pattern,这也反映在 pod 中。 But is a temporary work around as the core files generated are of zero size.但这是一种临时解决方法,因为生成的核心文件大小为零。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM