Open yaroslav-nakonechnikov opened 2 months ago
This issue is currently awaiting triage.
If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted
label and provide further guidance.
The triage/accepted
label can be added by org members by writing /triage accepted
in a comment.
Does it work if you do not customize PodSecurityContext ?
yes, it works perfectly.
and if i edit deployment like kubectl edit deployment -n ingress ingress-nginx-controller
:
$ kubectl get deployment -n ingress ingress-nginx-controller -o yaml | grep securityContext -A 5
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
--
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
--
securityContext:
sysctls:
- name: net.ipv4.ip_local_port_range
value: 1024 65000
- name: net.core.somaxconn
value: "32768"
it stats fine:
ingress-nginx-controller-db89d67bd-mpfkn:/etc/nginx$ sysctl net. | grep max
net.core.somaxconn = 32768
At least for 2 sysctl arguments, the error message is unknown value ;
range: invalid argument: unknown
So this is not a bug but a misconfiguration of sysctl arguments.
That kind of config is not in controller code as it just passes that from template to the Kubernetes API
/remove-kind bug
I think you should manually try those sysctl commands and see what fits
/kind support
but manually it works. I know that from hcl sometimes it is hard to pass some values, and for passing custom log_format - it looks extremely weird. but for sysctls i tried several notations - doesn't work.
workaround with additional modification after helm_release - it works without problem.
ps. almost same problem is with keda addon. But i will report it later, as it is not so critical.
There is a word about unsupported. Have you checked
% k explain pod.spec.securityContext.sysctls
KIND: Pod
VERSION: v1
FIELD: sysctls <[]Sysctl>
DESCRIPTION:
Sysctls hold a list of namespaced sysctls used for the pod. Pods with
unsupported sysctls (by the container runtime) might fail to launch. Note
that this field cannot be set when spec.os.name is windows.
Sysctl defines a kernel parameter to be set
FIELDS:
name <string> -required-
Name of a property to set
value <string> -required-
Value of a property to set
@longwuyuan if i manually (or even with terraform) updating deployment after initial helm install - it starts to work as expected. About unsupported sysctl parameters i've read, but it is different.
Then its a parsing problem. Have you played with the string.
yes, i've tried next versions: "controller.podSecurityContext.sysctls[1].value" = 32768 "controller.podSecurityContext.sysctls[1].value" = "32768" "controller.podSecurityContext.sysctls[1].value" = "\"32768\"" "controller.podSecurityContext.sysctls[1].value" = "'32768'" "controller.podSecurityContext.sysctls[1].value" = '32768'
nothing works.
reduce upper port number to 60000 and try
try
"sysctls.net\\.core\\.somaxconn" = "30000"
"sysctls.net\\.ipv4\\.ip_local_port_range" = "1024 60000"
or maybe ;
"controller.podSecurityContext.sysctls[1].name" = "net.core.somaxconn"
"controller.podSecurityContext.sysctls[1].value" = 32768
"controller.podSecurityContext.sysctls[0].name" = "net.ipv4.ip_local_port_range"
"controller.podSecurityContext.sysctls[0].value" = "1024 65000"
I am not sure how to solve but I am sure this is not controller code as these keys & values are passed straight from the rendered template to the kubeapi-server .... you can enable debug and check the json payload
i also tried outside of dynamic set:
set {
name = "controller.podSecurityContext.sysctls[0].value"
value = "32768"
type = "auto"
}
and
set {
name = "controller.podSecurityContext.sysctls[0].value"
value = 32768
type = "auto"
}
gives: Error: failed to replace object: Deployment in version "v1" cannot be handled as a Deployment: json: cannot unmarshal number into Go struct field Sysctl.spec.template.spec.securityContext.sysctls.value of type string
set {
name = "controller.podSecurityContext.sysctls"
value = "[\\{\"name\":\"net.core.somaxconn\"\\,\"value\":\"32768\"\\}\\,\\{\"name\":\"net.ipv4.ip_local_port_range\"\\,\"value\":\"1024 65000\"\\}]"
type = "auto"
}
and
set {
name = "controller.podSecurityContext.sysctls[0]"
value = "\\{\"name\":\"net.core.somaxconn\"\\,\"value\":\"32768\"\\}"
type = "auto"
}
gives Error: failed to replace object: Deployment in version "v1" cannot be handled as a Deployment: json: cannot unmarshal string into Go struct field PodSecurityContext.spec.template.spec.securityContext.sysctls of type []v1.Sysctl
Please come talk on Kubernetes Slack as there are not many resources here.
The error message is proof that this is about parsing and var interpolation. I think that this works without terraform or ArgoCD type of tools so its not a problem with the controller. Some expert of these tools has to comment how to inject int instead of string etc etc.
This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev
on Kubernetes Slack.
Hello,
What happened:
i'm getting next warning, which prevents to start nginx pod:
deploy was done via terraforms helm_release resource:
values are rendered like:
as i see, there is somehow additional chars passed there:
but if i write nex:
it fails on apply stage like:
Why? how it is possible to provide values, so it will work?
What you expected to happen:
Simple notation works without issues.
NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.): installed with chart 4.10.4