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

allow override of kubelet host with KUBERNETES_KUBELET_HOST env var #3051

Merged
merged 1 commit into from
Dec 5, 2016

Conversation

stonith
Copy link
Contributor

@stonith stonith commented Nov 27, 2016

Note: Please remember to review the Datadog Contribution Guidelines
if you have not yet done so.

What does this PR do?

dd-agent assumes that the kubelet API is available at the default gateway of the container. This PR allows overriding of the kubelet host if the KUBERNETES_KUBELET_HOST environment variable is found. As an example, the kubernetes downward API in 1.4+ can be used to specify the node name:

          - name: KUBERNETES_KUBELET_HOST
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName

Motivation

There are implementations of kubernetes where the kubelet API is not available at the default gateway. An example of this would be when Calico is used: projectcalico/calico-containers#1099

What inspired you to submit this pull request?

We're testing Calico with kubernetes and a docker-dd-agent daemonset does not function properly.

Additional Notes

I can cut a PR to update docs in DataDog/docker-dd-agent if this gets merged.

Anything else we should know when reviewing?

  • this addresses kubernetes environments where the kubelet api is
    not reachable at the default gateway
  • addresses projectcalico/calico-containers#1099

- this addresses kubernetes environments where the kubelet api is
  not reachable at the default gateway
- addresses projectcalico/calico-containers#1099
@caseydavenport
Copy link

@stonith Just to clarify my understanding:

fieldPath: spec.nodeName

means that the node's name in Kubernetes needs to be resolvable by the pod (or a valid IP address for that node), correct?

@stonith
Copy link
Contributor Author

stonith commented Nov 27, 2016

@caseydavenport in this example yes, the pod would have to be able to resolve the node's name.

@caseydavenport
Copy link

@stonith cool, thanks! This looks good to me.

@masci masci added this to the Triage milestone Dec 2, 2016
@remh
Copy link

remh commented Dec 5, 2016

Thanks! This looks great to me. @hkaj can you review as well ?

@remh remh modified the milestones: 5.11.0, Triage Dec 5, 2016
@hkaj hkaj self-assigned this Dec 5, 2016
@hkaj
Copy link
Member

hkaj commented Dec 5, 2016

Thanks @stonith. It looks good to me too, I'll probably merge it today.
As you mentioned we'll also need a PR in docker-dd-agent to add a mention of it in here: https://github.com/DataDog/docker-dd-agent/blob/master/README.md#environment-variables-1

Mind taking care of it too @stonith ?
Thanks again!

@hkaj
Copy link
Member

hkaj commented Dec 5, 2016

Just tested, all good.

@hkaj hkaj merged commit 8b0932f into DataDog:master Dec 5, 2016
@stonith stonith deleted the allow_specify_kubelet_host branch December 5, 2016 19:05
@stonith
Copy link
Contributor Author

stonith commented Dec 5, 2016

PR for the README.

NOTE:
When trying to implement this with CNI networking I ran into kubernetes/kubernetes#31307 which unfortunately means hostPort daemonset with my above example doesn't currently work. A NodePort service should work though.

@masci masci modified the milestones: 5.11.0, 5.12.0 Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants