-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
Fix configuration of Metadata Agent daemon set #56576
Conversation
/assign @bmoyles0117 |
@kawych: GitHub didn't allow me to assign the following users: bmoyles0117. Note that only kubernetes members can be assigned. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
@@ -22,7 +22,7 @@ spec: | |||
name: metadata-agent | |||
ports: | |||
- containerPort: 8000 | |||
hostPort: 8000 | |||
hostPort: 8799 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you also need to change the logging agent configuration to point to this port?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the logging agent doesn't support the host as a parameter. We should discuss if the port should be part of the same parameter, or a separate parameter entirely. Making it part of METADATA_AGENT_HOSTNAME would be easier, as we could check for the existence of a ":" in the hostname, and append :8000 if not found. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused -- the logging agent uses the metadata_agent_url
parameter, which can definitely include the port. Are you talking about the environment variables used by the container's entrypoint script? If so, then we can add a METADATA_AGENT_PORT variable or rename the current one to METADATA_AGENT_URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm referencing the container's entrypoint script.
This is where the sed replace occurs
https://github.com/GoogleCloudPlatform/google-fluentd/blob/master/docker/run.sh#L13
And this is what it's replacing "local-metadata-agent.stackdriver.com":8000, not the :8000. Easy enough to update.
https://github.com/GoogleCloudPlatform/google-fluentd/blob/master/docker/Dockerfile#L9
We can discuss the right naming for the env variable, but for now it's not modifiable in any existing docker image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you OK with this being final configuration for Metadata Agent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this configuration for the Metadata agent. However, in order for these changes to matter we still need to make changes to a few other places.
- The input source for containers needs to incorporate the local_resource_id label. You can see how did it below.
The section that this needs to be added in is here: https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/fluentd-gcp/fluentd-gcp-configmap.yaml#L74
$ curl -s https://storage.googleapis.com/stackdriver-container-alpha/configs/stackdriver-agents.yaml | cat -n | grep -C 5 local_resource_id
205 <match reform.**>
206 @type record_reformer
207 enable_ruby true
208 <record>
209 "logging.googleapis.com/local_resource_id" ${"k8s_container.#{tag_parts[4].split('-')[-1]}"}
210 </record>
212 tag ${if record['stream'] == 'stderr' then 'raw.kubernetes.stderr' else 'raw.kubernetes.stdout' end}
213 </match>
-
You need to update the google_cloud output plugin for kubernetes.* to enable the metadata agent.
You can do this by adding these lines. However you manage to get these lines in there, you'll need to ensure that the hostname is set to the
spec.nodeName
from the downwards API. We do this in ourrun.sh
as you're familiar with here: https://github.com/GoogleCloudPlatform/google-fluentd/blob/master/docker/run.sh#L15
# Enable metadata agent lookups.
enable_metadata_agent true
metadata_agent_url "http://local-metadata-agent.stackdriver.com:8799"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@crassirostris
Mik, do you agree with these changes? Do you have this in your plans?
/assign @gmarek |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note my comments as we'll need to make changes to the fluentd-gcp kubernetes manifests.
@@ -22,7 +22,7 @@ spec: | |||
name: metadata-agent | |||
ports: | |||
- containerPort: 8000 | |||
hostPort: 8000 | |||
hostPort: 8799 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this configuration for the Metadata agent. However, in order for these changes to matter we still need to make changes to a few other places.
- The input source for containers needs to incorporate the local_resource_id label. You can see how did it below.
The section that this needs to be added in is here: https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/fluentd-gcp/fluentd-gcp-configmap.yaml#L74
$ curl -s https://storage.googleapis.com/stackdriver-container-alpha/configs/stackdriver-agents.yaml | cat -n | grep -C 5 local_resource_id
205 <match reform.**>
206 @type record_reformer
207 enable_ruby true
208 <record>
209 "logging.googleapis.com/local_resource_id" ${"k8s_container.#{tag_parts[4].split('-')[-1]}"}
210 </record>
212 tag ${if record['stream'] == 'stderr' then 'raw.kubernetes.stderr' else 'raw.kubernetes.stdout' end}
213 </match>
-
You need to update the google_cloud output plugin for kubernetes.* to enable the metadata agent.
You can do this by adding these lines. However you manage to get these lines in there, you'll need to ensure that the hostname is set to the
spec.nodeName
from the downwards API. We do this in ourrun.sh
as you're familiar with here: https://github.com/GoogleCloudPlatform/google-fluentd/blob/master/docker/run.sh#L15
# Enable metadata agent lookups.
enable_metadata_agent true
metadata_agent_url "http://local-metadata-agent.stackdriver.com:8799"
[MILESTONENOTIFIER] Milestone Pull Request Needs Attention @gmarek @kawych @piosz @kubernetes/sig-instrumentation-misc Action required: During code freeze, pull requests in the milestone should be in progress. Note: This pull request is marked as Example update:
Pull Request Labels
|
Please update the status of this issue. Is this PR ready to merge? Does it require another PR for supporting changes? |
This PR is ready to merge. Another PR will be needed to change configurations of other components accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@gmarek PTAL |
@@ -158,7 +158,7 @@ ENABLE_METRICS_SERVER="${KUBE_ENABLE_METRICS_SERVER:-true}" | |||
ENABLE_METADATA_AGENT="${KUBE_ENABLE_METADATA_AGENT:-none}" | |||
|
|||
# Version tag of metadata agent | |||
METADATA_AGENT_VERSION="${KUBE_METADATA_AGENT_VERSION:-0.2-0.0.13-5}" | |||
METADATA_AGENT_VERSION="${KUBE_METADATA_AGENT_VERSION:-0.2-0.0.13-5-watch}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's that? what's the versioning scheme of metadata agent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version will change in a bit once the watch
branch is merged into master
. This scheme is: <Dockerfile version>-<package version>[-<branch>]...
/approve no-issue |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gmarek, kawych, piosz Associated issue requirement bypassed by: gmarek, piosz The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Fixes small errors in Stackdriver Metadata Agent configuration: port number and default version.
Release note: