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

kube-proxy uses token to access port 443 of apiserver #7303

Merged
merged 1 commit into from
Apr 27, 2015

Conversation

erictune
Copy link
Member

Tested on GCE.
Includes untested modifications for AWS and Vagrant.
No changes for any other distros.
Probably will work on other up-to-date providers
but beware. Symptom would be that service proxying
stops working.

  1. Generates a token kube-proxy in AWS, GCE, and Vagrant setup scripts.
  2. Distributes the token via salt-overlay, and salt to /var/lib/kube-proxy/kubeconfig
  3. Changes kube-proxy args:

Possible ways this might break other distros:

Mitigation: there is an default empty kubeconfig file.
If the distro does not populate the salt-overlay, then
it should get the empty, which parses to an empty
object, which, combined with the --master argument,
should still work.

Mitigation:

  • azure: Special case to use 7080 in
  • rackspace: way out of date, so don't care.
  • vsphere: way out of date, so don't care.
  • other distros: not using salt.

@erictune
Copy link
Member Author

Testing consisted of kube-up, followed by inspecting kube-proxy logs to ensure it was reading data.

@erictune
Copy link
Member Author

Suggest @cjcullen or @zmerlynn as reviewers.

@roberthbailey
Copy link
Contributor

You included changes for vagrant & aws. Have you tested those?

/cc @justinsb & @derekwaynecarr

@roberthbailey
Copy link
Contributor

FYI, the file cluster/saltbase/salt/kube-proxy/kubeconfig has no changes and doesn't need to be included in your PR.

@@ -248,13 +248,40 @@ function create-salt-auth() {
mkdir -p /srv/salt-overlay/salt/kube-apiserver
(umask 077;
echo "${KUBE_BEARER_TOKEN},admin,admin" > "${KNOWN_TOKENS_FILE}";
echo "${KUBELET_TOKEN},kubelet,kubelet" >> "${KNOWN_TOKENS_FILE}")
echo "${KUBELET_TOKEN},kubelet,kubelet" >> "${KNOWN_TOKENS_FILE}";
echo "${KUBE_PROXY_TOKEN},kubelet,kubelet" >> "${KNOWN_TOKENS_FILE}")
Copy link
Member

Choose a reason for hiding this comment

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

did we want this to be "${KUBE_PROXY_TOKEN},kube-proxy,kube-proxy"?

Copy link
Member

Choose a reason for hiding this comment

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

Looks like you had kube_proxy for AWS/Vagrant.

@cjcullen
Copy link
Member

LGTM other than my 1 comment.

@cjcullen cjcullen self-assigned this Apr 24, 2015
Tested on GCE.
Includes untested modifications for AWS and Vagrant.
No changes for any other distros.
Probably will work on other up-to-date providers
but beware.  Symptom would be that service proxying
stops working.

 1. Generates a token kube-proxy in AWS, GCE, and Vagrant setup scripts.
 1. Distributes the token via salt-overlay, and salt to /var/lib/kube-proxy/kubeconfig
 1. Changes kube-proxy args:
   - use the --kubeconfig argument
   - changes --master argument from http://MASTER:7080 to https://MASTER
     - http -> https
     - explicit port 7080 -> implied 443

Possible ways this might break other distros:

Mitigation: there is an default empty kubeconfig file.
If the distro does not populate the salt-overlay, then
it should get the empty, which parses to an empty
object, which, combined with the --master argument,
should still work.

Mitigation:
  - azure: Special case to use 7080 in
  - rackspace: way out of date, so don't care.
  - vsphere: way out of date, so don't care.
  - other distros: not using salt.
@erictune
Copy link
Member Author

Good catch. Fixed.

@erictune
Copy link
Member Author

@cjcullen ptal

@cjcullen
Copy link
Member

Content LGTM now. Can you remove the empty cluster/saltbase/salt/kube-proxy/kubeconfig file before merge?

@erictune
Copy link
Member Author

That file is going to avoid a salt error on providers that don't generate this file.

@cjcullen
Copy link
Member

Ah. Okay, LGTM then.

cjcullen added a commit that referenced this pull request Apr 27, 2015
kube-proxy uses token to access port 443 of apiserver
@cjcullen cjcullen merged commit 39c5bf3 into kubernetes:master Apr 27, 2015
@erictune erictune deleted the kube_env3 branch September 29, 2015 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants