Skip to content

Log to standard output result in garbage character in add function #1248

@ozaditya

Description

@ozaditya

What happened:

After setting environment variable AWS_VPC_K8S_PLUGIN_LOG_FILE to stdout and deploying CNI version 1.7.3.
I have observed that CFN fails to add ip to pods.

Logs from CNI:

Send AddNetworkReply: IPv4Addr 10.1.161.151, DeviceNumber: 0, err: \u003cnil\u003e"}
Received DelNetwork for Sandbox 4da84e08dd17a4e2cceacbf31d04801575cfab2e19fae462a17c95921b422ee5"}
DelNetworkRequest: ClientVersion:\"v1.7.3\" K8S_POD_NAME:\"datadog-agent-wt4hd\" K8S_POD_NAMESPACE:\"datadog\" K8S_POD_INFRA_CONTAINER_ID:\"4da84e08dd17a4e2cceacbf31d04801575cfab2e19fae462a17c95921b422ee5\" Reason:\"PodDeleted\" ContainerID:\"4da84e08dd17a4e2cceacbf31d04801575cfab2e19fae462a17c95921b422ee5\"

Logs from kubelet:

Error adding datadog_datadog-agent-wt4hd/4da84e08dd17a4e2cceacbf31d04801575cfab2e19fae462a17c95921b422ee5 to network aws-cni/aws-cni: invalid character '{' after top-level value
RunPodSandbox from runtime service failed: rpc error: code = Unknown desc = failed to set up sandbox container "4da84e08dd17a4e2cceacbf31d04801575cfab2e19fae462a17c95921b422ee5" network for pod "datadog-agent-wt4hd": NetworkPlugin cni failed to set up pod "datadog-agent-wt4hd_datadog" network: invalid character '{' after top-level value

What you expected to happen:

Since its documented in Read Me that CNI log can be sent on stdout. I expect CNI to function properly.

snippet:
AWS_VPC_K8S_CNI_LOG_FILE
Type: String
Default: /host/var/log/aws-routed-eni/ipamd.log
Valid Values: stdout or a file path
Specifies where to write the logging output of ipamd. Either to stdout or to override the default file (i.e., /var/log/aws-routed-eni/ipamd.log).

How to reproduce it (as minimally and precisely as possible):
Set above environment variable to stdout or simply change cni config file present at path “/etc/cni/net.d” with name “10-aws.conflist” to below.

{
"cniVersion": "0.3.1",
"name": "aws-cni",
"plugins": [
{
"name": "aws-cni",
"type": "aws-cni",
"vethPrefix": "eni",
"mtu": "9001",
"pluginLogFile": "stdout",
"pluginLogLevel": "Debug"
},
{
"type": "portmap",
"capabilities": {"portMappings": true},
"snat": true
}
]
}

Anything else we need to know?:

I believe error was generated by add function.

resp := rpc.AddNetworkReply{

I believe it trace back to project https://github.com/containernetworking/cni/

Environment:

  • Kubernetes version (use kubectl version): Currrently tested on version 1.15
  • CNI Version: 1.7.x same is true for 1.6.x
  • OS (e.g: cat /etc/os-release): Amazon linux 2
  • Kernel (e.g. uname -a): Linux ip-172-31-45-225.ec2.internal 4.14.171-136.231.amzn2.x86_64 Initial commit of amazon-vpc-cni-k8s #1 SMP Thu Feb 27 20:22:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions