Kubernetes:pod 中 env 的计数最大值是多少?
Kubernetes: What is the maximum value of env's count in pod?
Kubernetes:pod 中env 计数的最大值是多少?
我在 pod.Spec 'enableServiceLinks' 中找到了一个默认为 true 的选项,但是当 enableServiceLinks=true 时 pod 有更多的环境。所以我将它设置为 false,事情变得更好了。我想知道,一个 pod 中可以存在多少 envs?
pod 中的 env 数量没有限制。您不受 count/numbet/etc 的限制 - 您受内存本身的限制。
您在任何 linux os 中拥有的是 execve。不同部分没有快捷方式,您的是 参数和环境大小的限制
Most UNIX implementations impose some limit on the total size of the
command-line argument (argv) and environment (envp) strings that may
be passed to a new program. POSIX.1 allows an implementation to
advertise this limit using the ARG_MAX constant (either defined in
<limits.h> or available at run time using the call
sysconf(_SC_ARG_MAX)). On Linux prior to kernel 2.6.23, the memory
used to store the environment and argument strings was limited to 32
pages (defined by the kernel constant MAX_ARG_PAGES). On architectures
with a 4-kB page size, this yields a maximum size of 128 kB.
On kernel 2.6.23 and later, most architectures support a size limit
derived from the soft RLIMIT_STACK resource limit (see getrlimit(2))
that is in force at the time of the execve() call. (Architectures with
no memory management unit are excepted: they maintain the limit that
was in effect before kernel 2.6.23.) This change allows programs to
have a much larger argument and/or environment list. For these
architectures, the total size is limited to 1/4 of the allowed stack
size. (Imposing the 1/4-limit ensures that the new program always has
some stack space.) Since Linux 2.6.25, the kernel places a floor of 32
pages on this size limit, so that, even when RLIMIT_STACK is set very
low, applications are guaranteed to have at least as much argument and
environment space as was provided by Linux 2.6.23 and earlier. (This
guarantee was not provided in Linux 2.6.23 and 2.6.24.) Additionally,
the limit per string is 32 pages (the kernel constant MAX_ARG_STRLEN),
and the maximum number of strings is 0x7FFFFFFF.
所以,2个字,
在内核 2.6.23 之前的 Linux 上:最大大小为 128 kB
在内核 2.6.23 及更高版本上:most 架构支持来自软 RLIMIT_STACK
资源
的大小限制
我也认为 - etcd 有 1MB 的限制(这是 kubernetes 保存所有对象的地方)。所以如果你使用 configmaps - 你必须记住这个限制。限制 1MB 是 etcd 限制本身。
要检查的网址:
-
@Rico 在堆栈上的回答:
Kubernetes:pod 中env 计数的最大值是多少? 我在 pod.Spec 'enableServiceLinks' 中找到了一个默认为 true 的选项,但是当 enableServiceLinks=true 时 pod 有更多的环境。所以我将它设置为 false,事情变得更好了。我想知道,一个 pod 中可以存在多少 envs?
pod 中的 env 数量没有限制。您不受 count/numbet/etc 的限制 - 您受内存本身的限制。
您在任何 linux os 中拥有的是 execve。不同部分没有快捷方式,您的是 参数和环境大小的限制
Most UNIX implementations impose some limit on the total size of the command-line argument (argv) and environment (envp) strings that may be passed to a new program. POSIX.1 allows an implementation to advertise this limit using the ARG_MAX constant (either defined in <limits.h> or available at run time using the call sysconf(_SC_ARG_MAX)). On Linux prior to kernel 2.6.23, the memory used to store the environment and argument strings was limited to 32 pages (defined by the kernel constant MAX_ARG_PAGES). On architectures with a 4-kB page size, this yields a maximum size of 128 kB.
On kernel 2.6.23 and later, most architectures support a size limit derived from the soft RLIMIT_STACK resource limit (see getrlimit(2)) that is in force at the time of the execve() call. (Architectures with no memory management unit are excepted: they maintain the limit that was in effect before kernel 2.6.23.) This change allows programs to have a much larger argument and/or environment list. For these architectures, the total size is limited to 1/4 of the allowed stack size. (Imposing the 1/4-limit ensures that the new program always has some stack space.) Since Linux 2.6.25, the kernel places a floor of 32 pages on this size limit, so that, even when RLIMIT_STACK is set very low, applications are guaranteed to have at least as much argument and environment space as was provided by Linux 2.6.23 and earlier. (This guarantee was not provided in Linux 2.6.23 and 2.6.24.) Additionally, the limit per string is 32 pages (the kernel constant MAX_ARG_STRLEN), and the maximum number of strings is 0x7FFFFFFF.
所以,2个字,
在内核 2.6.23 之前的 Linux 上:最大大小为 128 kB
在内核 2.6.23 及更高版本上:most 架构支持来自软
的大小限制RLIMIT_STACK
资源
我也认为 - etcd 有 1MB 的限制(这是 kubernetes 保存所有对象的地方)。所以如果你使用 configmaps - 你必须记住这个限制。限制 1MB 是 etcd 限制本身。
要检查的网址:
@Rico 在堆栈上的回答: