Pod does not have label vpc.amazonaws.com/PrivateIPv4Address
Hello folks,
I'm trying to setup an EKS cluster to run some windows workloads but I'm facing the following issue:
Warning FailedCreatePodSandBox 6m7s kubelet, ip-10-41-19-83.ec2.internal Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "5de707032c2ef1d07b156957f1befca65a5486a62dc4d049aa5a2a76c33e82e7" network for pod "windows-server-iis-548fd8f899-v5pxs": networkPlugin cni failed to set up pod "windows-server-iis-548fd8f899-v5pxs_default" network: failed to parse Kubernetes args: pod does not have label vpc.amazonaws.com/PrivateIPv4Address
The same issue was reported on #463.
Here are logs of the admission-webhook
λ kubectl -n kube-system logs vpc-admission-webhook-75ffd84dc9-6rqwg I0918 13:12:15.842227 1 main.go:72] Initializing vpc-admission-webhook version 0.2.3. I0918 13:12:15.842977 1 webhook.go:145] Setting up webhook with OSLabelSelectorOverride: windows. I0918 13:12:15.843029 1 main.go:105] Webhook Server started. I0918 13:12:15.843031 1 main.go:96] Listening on :61800 for metrics and healthz I0918 13:57:06.598576 1 webhook.go:241] AdmissionReview for Kind=/v1, Kind=Pod, Namespace=windows Name= () UID=8b403ddc-4447-4617-9a29-ae3a5781e40c PatchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller 91ccc2ac-d7eb-400f-b96f-e5190597ee86 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}. I0918 13:57:06.598694 1 webhook.go:258] AdmissionResponse: patch=[{"op":"replace","path":"/spec/containers","value":[{"name":"windows-server-iis","image":"mcr.microsoft.com/windows/servercore:1809","command":["powershell.exe","-command","Add-WindowsFeature Web-Server; Invoke-WebRequest -UseBasicParsing -Uri 'https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.6/ServiceMonitor.exe' -OutFile 'C:\ServiceMonitor.exe'; echo '\u003chtml\u003e\u003cbody\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cmarquee\u003e\u003cH1\u003eHello EKS!!!\u003cH1\u003e\u003cmarquee\u003e\u003c/body\u003e\u003chtml\u003e' \u003e C:\inetpub\wwwroot\default.html; C:\ServiceMonitor.exe 'w3svc'; "],"ports":[{"name":"http","containerPort":80,"protocol":"TCP"}],"resources":{"limits":{"vpc.amazonaws.com/PrivateIPv4Address":"1"},"requests":{"vpc.amazonaws.com/PrivateIPv4Address":"1"}},"volumeMounts":[{"name":"default-token-grjsq","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}]}]. I0918 15:48:30.031335 1 webhook.go:241] AdmissionReview for Kind=/v1, Kind=Pod, Namespace=default Name= () UID=06eb607f-a84f-4b9c-b63d-f88f3e078160 PatchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller 91ccc2ac-d7eb-400f-b96f-e5190597ee86 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}. I0918 15:48:30.031644 1 webhook.go:258] AdmissionResponse: patch=[{"op":"replace","path":"/spec/containers","value":[{"name":"mssql","image":"scr.sitecore.com/sxp/nonproduction/mssql-developer:2017-10.0.0-ltsc2019","ports":[{"containerPort":1433,"protocol":"TCP"}],"env":[{"name":"SA_PASSWORD","valueFrom":{"secretKeyRef":{"name":"sitecore-database","key":"sitecore-databasepassword.txt"}}},{"name":"ACCEPT_EULA","value":"Y"}],"resources":{"limits":{"vpc.amazonaws.com/PrivateIPv4Address":"1"},"requests":{"vpc.amazonaws.com/PrivateIPv4Address":"1"}},"volumeMounts":[{"name":"default-token-52jj4","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}]}]. I0918 15:48:30.165506 1 webhook.go:241] AdmissionReview for Kind=/v1, Kind=Pod, Namespace=default Name= () UID=f22cc64b-481a-4d98-9a03-18ed382bb582 PatchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller 91ccc2ac-d7eb-400f-b96f-e5190597ee86 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}. I0918 15:48:30.170895 1 webhook.go:258] AdmissionResponse: patch=[{"op":"replace","path":"/spec/containers","value":[{"name":"sitecore-redis","image":"scr.sitecore.com/sxp/sitecore-redis:10.0.0-ltsc2019","ports":[{"containerPort":6379,"protocol":"TCP"}],"resources":{"limits":{"vpc.amazonaws.com/PrivateIPv4Address":"1"},"requests":{"vpc.amazonaws.com/PrivateIPv4Address":"1"}},"volumeMounts":[{"name":"default-token-52jj4","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}]}]. I0918 15:48:30.353730 1 webhook.go:241] AdmissionReview for Kind=/v1, Kind=Pod, Namespace=default Name= () UID=ed2f6300-77f9-43f1-8444-7c1ecc24c829 PatchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller 91ccc2ac-d7eb-400f-b96f-e5190597ee86 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}. I0918 15:48:30.353804 1 webhook.go:258] AdmissionResponse: patch=[{"op":"replace","path":"/spec/containers","value":[{"name":"solr","image":"scr.sitecore.com/sxp/nonproduction/solr:8.4.0-10.0.0-ltsc2019","ports":[{"containerPort":8983,"protocol":"TCP"}],"env":[{"name":"SOLR_MODE","value":"solrcloud"}],"resources":{"limits":{"vpc.amazonaws.com/PrivateIPv4Address":"1"},"requests":{"vpc.amazonaws.com/PrivateIPv4Address":"1"}},"volumeMounts":[{"name":"default-token-52jj4","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}]}]. I0918 15:52:11.493259 1 webhook.go:241] AdmissionReview for Kind=/v1, Kind=Pod, Namespace=ingresses Name= () UID=604904b2-720f-4d07-83aa-a38f2da44999 PatchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller 91ccc2ac-d7eb-400f-b96f-e5190597ee86 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}. I0918 15:52:11.493288 1 webhook.go:289] Skip mutation for as the target platform is . I0918 15:52:11.493296 1 webhook.go:245] Skipping mutation for / due to policy check. I0918 15:53:28.625186 1 webhook.go:241] AdmissionReview for Kind=/v1, Kind=Pod, Namespace=default Name= () UID=0a6b15ab-e143-4fb8-bafc-6f22cfafa037 PatchOperation=CREATE UserInfo={system:serviceaccount:kube-system:job-controller e4914e32-389c-4ab0-8f9e-17454dcbee70 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}. I0918 15:53:28.625216 1 webhook.go:289] Skip mutation for as the target platform is . I0918 15:53:28.625225 1 webhook.go:245] Skipping mutation for / due to policy check. I0918 15:53:28.702461 1 webhook.go:241] AdmissionReview for Kind=/v1, Kind=Pod, Namespace=default Name= () UID=ebd09eb5-9699-4c23-b4f2-53dba1fe7ed8 PatchOperation=CREATE UserInfo={system:serviceaccount:kube-system:job-controller e4914e32-389c-4ab0-8f9e-17454dcbee70 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}. I0918 15:53:28.702498 1 webhook.go:289] Skip mutation for as the target platform is . I0918 15:53:28.702507 1 webhook.go:245] Skipping mutation for / due to policy check.
I managed it to get it working.
I managed it to get it working.
Can you share how you fixed it?
Ta7ann w miboun @felixep
I managed it to get it working.
If you solve something try to POST ANSWER NEXT TIME
The issue was with the nginx ingress controller (the nginx version). Using the official helm chart and deploying it as a daemonset, it will create the service as NodePort and it will bind port 443 on the same node were the vpc resource controller and the vpc admission webhook runs.
@felixep : I am also facing the same issue, kindly elloborate what to do, I am trying for windows node as per tutorial but not able to solve my issue.
I faced the issue because I wanted to deploy the ingress controller as a daemonset to guarantee a pod per node. But, as you can see on the daemonset template definition, docker will bind port 443 on the node to port 443 on the container. So, all traffic to port 443 will get redirected to the nginx ingress controller and that's why the vpc-admission-webhook doesn't know about new pods any more.
https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/helm-chart/templates/controller-daemonset.yaml#L50
containers:
- name: {{ include "nginx-ingress.name" . }}
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443
To solved this problem I decided to use deployment instead of daemonset which means using the default value here
controller:
## The name of the Ingress controller daemonset or deployment.
## Autogenerated if not set or set to "".
# name: nginx-ingress
## The kind of the Ingress controller installation - deployment or daemonset.
kind: deployment
Thanks @felixep for detailed information. However I am trying to deploy windows node group with t2.micro instance and getting error to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container
hi guys, any solution on that?