Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload container runtime log to sd/es. #59103

Merged

Conversation

Random-Liu
Copy link
Member

@Random-Liu Random-Liu commented Jan 31, 2018

I've verified this in my environment. My stackdriver has an extra container-runtime entry for node log, and it collects container runtime daemon log correctly.

@yujuhong @feiskyer @crassirostris @piosz
@kubernetes/sig-node-pr-reviews @kubernetes/sig-instrumentation-pr-reviews
Signed-off-by: Lantao Liu lantaol@google.com

Release note:

Container runtime daemon (e.g. dockerd) logs in GCE cluster will be uploaded to stackdriver and elasticsearch with tag `container-runtime`

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 31, 2018
@Random-Liu
Copy link
Member Author

@crassirostris Please note that, with this there will be both docker tag and container-runtime tag in GKE. And for docker as container runtime, their content will be the same. Is this acceptable?

@Random-Liu
Copy link
Member Author

Random-Liu commented Jan 31, 2018

/test pull-kubernetes-unit

@yujuhong
Copy link
Contributor

yujuhong commented Feb 1, 2018

/cc @igorpeshansky for input on how tags are consumed in stackdriver.

@coffeepac
Copy link
Contributor

@Random-Liu this should rev the version of the fluentd-es addon container image. need to update:

  • cluster/addons/fluentd-elasticsearch/fluentd-es-image/Makefile#L19
  • cluster/addons/fluentd-elasticsearch/fluentd-es-ds.yaml#L51 (and four other locations in this file)

current value is v2.0.4, I believe that v2.0.5 is appropriate.

@igorpeshansky
Copy link

fluentd-gcp actually expects the tag to be in a certain format and parses it to extract container identification. So you can't just use an arbitrary tag -- the logs will not be attributed to the correct container.

@yujuhong
Copy link
Contributor

yujuhong commented Feb 6, 2018

fluentd-gcp actually expects the tag to be in a certain format and parses it to extract container identification. So you can't just use an arbitrary tag -- the logs will not be attributed to the correct container.

@igorpeshansky the tag is added for the container runtime (e.g., docker daemon) log itself, which does not map to any "container". Does the same rule still apply?

@igorpeshansky
Copy link

Well, the question is which resource in Stackdriver the log is going to be associated with. By default, the logging agent expects the tag to be in a certain format to extract the resource information -- if the tag doesn't match, it won't be able to infer the resource, and there is currently no easy way to supply one directly to the agent.

@Random-Liu
Copy link
Member Author

Random-Liu commented Feb 6, 2018

current value is v2.0.4, I believe that v2.0.5 is appropriate.

@coffeepac Thanks! I'll do that if people are ok with this PR. :)

By default, the logging agent expects the tag to be in a certain format to extract the resource information

@igorpeshansky This tag container-runtime is for container runtime daemon log, e.g. docker log. It is not for container log. The certain format you linked seems to be tag for container log?

@yujuhong
Copy link
Contributor

yujuhong commented Feb 6, 2018

@igorpeshansky This tag container-runtime is for container runtime daemon log, e.g. docker log. It is not for container log. The certain format you linked seems to be tag for container log?

@igorpeshansky I also didn't find anything special usage of the "docker" tag in the files you linked. If that's the case, does fluentd simply pass the tag to stackdriver?

@igorpeshansky
Copy link

Right, in that case fluentd will default to the instance resource and pass the tag to Stackdriver. There will be no association with the Kubernetes node or any other Kubernetes entity.

@Random-Liu
Copy link
Member Author

Right, in that case fluentd will default to the instance resource and pass the tag to Stackdriver. There will be no association with the Kubernetes node or any other Kubernetes entity.

Can I understand this as for docker daemon log, either docker tag or container-runtime tag, it doesn't make difference to stackdriver?

Do we assume that there is a docker log tag in stackdriver? If not, it seems fine to gradually switch to container-runtime tag. :)

@yujuhong
Copy link
Contributor

yujuhong commented Feb 7, 2018

Right, in that case fluentd will default to the instance resource and pass the tag to Stackdriver. There will be no association with the Kubernetes node or any other Kubernetes entity.

I see. The logs are only associated with the GCE VM instances, and these logs will have two tags (container-runtime and docker) for the time being.

@igorpeshansky
Copy link

There is no docker tag in Stackdriver — unknown tags are translated into log names, which are per-project and user-defined. Feel free to use either.

@Random-Liu
Copy link
Member Author

@igorpeshansky Thanks a lot for the information. :)

@roberthbailey
Copy link
Contributor

/approve (for cluster directory changes)

@yujuhong
Copy link
Contributor

yujuhong commented Feb 7, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 7, 2018
@Random-Liu
Copy link
Member Author

Random-Liu commented Feb 8, 2018

@coffeepac This is only a config change. Do we really want to build a new image with new version?

I feel like we should only update the config version https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/fluentd-elasticsearch/fluentd-es-configmap.yaml#L4

@Random-Liu Random-Liu force-pushed the upload-container-runtime-log branch from de37dcb to 5c4a9ec Compare February 8, 2018 02:10
@Random-Liu
Copy link
Member Author

@coffeepac Updated from 0.1.3 to 0.1.4

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 8, 2018
@Random-Liu
Copy link
Member Author

Apply LGTM based on #59103 (comment)

@Random-Liu Random-Liu added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 8, 2018
@coffeepac
Copy link
Contributor

@Random-Liu looks good! thanks.

@coffeepac
Copy link
Contributor

/test pull-kubernetes-bazel-test

@@ -2041,6 +2041,11 @@ function start-fluentd-resource-update {
wait-for-apiserver-and-update-fluentd ${fluentd_gcp_yaml} &
}

# Update {{ container-runtime }} with actual container runtime name.
function update-container-runtime {
sed -i -e "s@{{ *container_runtime *}}@${CONTAINER_RUNTIME_NAME:-docker}@g" "$1"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a local variable from the argument, so it's much easier to read this code later (i.e. local -r configmap_path="$1")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

@crassirostris crassirostris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the change!

Please bump fluentd-gcp configmap version & both for fluentd-gcp and fluentd-es sync configmap version in the configmap manifest file & in the damonset manifest file

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2018
@Random-Liu
Copy link
Member Author

Random-Liu commented Feb 12, 2018

Please bump fluentd-gcp configmap version & both for fluentd-gcp and fluentd-es sync configmap version in the configmap manifest file & in the damonset manifest file

Done. fluentd-es-config is changed to 0.1.4. fluentd-gcp-config is changed to 1.2.4.
Thanks for reviewing!

@Random-Liu
Copy link
Member Author

/test pull-kubernetes-bazel-test

Copy link

@crassirostris crassirostris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, otherwise LGTM, thanks for the change!

@@ -82,7 +82,8 @@ NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-cos-cloud}
NODE_SERVICE_ACCOUNT=${KUBE_GCE_NODE_SERVICE_ACCOUNT:-default}
CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker}
CONTAINER_RUNTIME_ENDPOINT=${KUBE_CONTAINER_RUNTIME_ENDPOINT:-}
LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-docker load -i}
CONTAINER_RUNTIME_NAME=${KUBE_CONTAINER_RUNTIME_NAME:-}
LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this parameters changed? I don't understand how it's related to the rest of the changes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't need a default value here. The default value is set at https://github.com/kubernetes/kubernetes/blob/master/cluster/gce/gci/configure.sh#L261.

I added the initial code, just want to do a bit cleanup. :P

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for the explanation!

@Random-Liu
Copy link
Member Author

/test pull-kubernetes-bazel-test

Signed-off-by: Lantao Liu <lantaol@google.com>
@Random-Liu Random-Liu force-pushed the upload-container-runtime-log branch from 29c970b to 8d920d0 Compare February 13, 2018 18:25
Copy link

@crassirostris crassirostris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@@ -82,7 +82,8 @@ NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-cos-cloud}
NODE_SERVICE_ACCOUNT=${KUBE_GCE_NODE_SERVICE_ACCOUNT:-default}
CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker}
CONTAINER_RUNTIME_ENDPOINT=${KUBE_CONTAINER_RUNTIME_ENDPOINT:-}
LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-docker load -i}
CONTAINER_RUNTIME_NAME=${KUBE_CONTAINER_RUNTIME_NAME:-}
LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for the explanation!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2018
@crassirostris
Copy link

/approve

@crassirostris
Copy link

/retest

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: crassirostris, Random-Liu, roberthbailey, yujuhong

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these OWNERS Files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 14, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/node Categorizes an issue or PR as relevant to SIG Node. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants