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

Make service-account secrets in kubectl form. #7011

Closed
wants to merge 1 commit into from

Conversation

erictune
Copy link
Member

Changes approach taken in #5470
Instead of creating a kubernetes_auth file,
which we are tring to get away from, creates
a kubeconfig file, which is the new hotness.

Instead of creating the kubeconfig file in the
kube-addon script on the master, it creates
it at the time of salt-overlay generation.
More information is available at this time.

In particular, the master certs and master address
are handy at this point, so those are included in
the kubeconfig file.

The kube-addons script is simplified because the secret objects
are now just plain olf yaml files, which it knows how to
create, just like it creates pods and services.

Kubectl is used to generate the kubeconfig file.
This ensures correct format and is more self-documenting,
and matches how the admin credentials are done.

TODO(erictune): do this for kubelet.

Changes approach taken in kubernetes#5470
Instead of creating a kubernetes_auth file,
which we are tring to get away from, creates
a kubeconfig file, which is the new hotness.

Instead of creating the kubeconfig file in the
kube-addon script on the master, it creates
it at the time of salt-overlay generation.
More information is available at this time.

In particular, the master certs and master address
are handy at this point, so those are included in
the kubeconfig file.

The kube-addons script is simplified because the secret objects
are now just plain olf yaml files, which it knows how to
create, just like it creates pods and services.

Kubectl is used to generate the kubeconfig file.
This ensures correct format and is more self-documenting,
and matches how the admin credentials are done.

TODO(erictune): do this for kubelet.
@erictune
Copy link
Member Author

@zmerlynn reviewed the last PR like this. If he is available, he is a good reviewer for this.
@cjcullen is starting in this area and could review, and @jlowdermilk has some context too.

@zmerlynn
Copy link
Member

Sure. I need to grab a beer anyways.

@zmerlynn zmerlynn self-assigned this Apr 17, 2015
mkdir -p $(dirname "${kubeconfig}")
touch "${kubeconfig}"
fi
local context="local"
Copy link
Member

Choose a reason for hiding this comment

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

Huh? What's going on here between this and line 79?

@zmerlynn
Copy link
Member

LGTM except some nits.

local kubeconfig=$1
local kube_user=$2
local token=$3
local context="pod" # Any string would do here because a service account kubeconfig
Copy link
Contributor

Choose a reason for hiding this comment

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

Even if any string will do, I'd recommend something like service-account-context.

@erictune
Copy link
Member Author

This doesn't work at all.
cluster/common.sh is not available from within cluster/gce/configure-vm.sh. The latter runs on the VM.
Also, kubectl is not available on the VM, at least at the point where this runs, which is before salt starts.
Also, the certs are not available at this point.

So, configure-vm is the wrong place to be setting this stuff up. I am going to have to go back to the kube-addons approach.

@erictune erictune closed this Apr 18, 2015
@zmerlynn
Copy link
Member

@erictune: Sorry for not noticing. I blame Friday afternoon.

I have a silly proposal before you go the other route. I feel like the create-salt-auth call is way early in configure-vm.sh - I put it in that order for legacy reasons when I factored all the things into functions, but honestly, there's no reason the auth files need to get created that early. I think, but don't quote me, that you could actually move create-salt-auth right before run-salt.

@zmerlynn
Copy link
Member

(In fact, I suspect the logical thing is to move ensure-kube-token / create-salt-pillar / create-salt-auth all down to just before run-salt.)

@erictune
Copy link
Member Author

Doing it before run-salt is still too early to use kubectl and too early to read the certs.

@erictune erictune deleted the kubeconfig_secret branch August 8, 2017 18:21
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