-
Notifications
You must be signed in to change notification settings - Fork 712
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
k8s client forgets to use CA when API URL specified #1810
Comments
We might want to provide a flag to trust the CA as well. |
I am not sure we want to do that, it encourages insecure use. |
I think the simplest and most complete way to provide an off-cluster authentication scheme is to specify the kubeconfig file like The kubeconfig file could be mounted in the probes as a secret. Otherwise we need to provide a gazillion arguments for the client certificate, server certificate, key etc ... |
I agree. The reason I brought this up, is that from the UX perspective it may be sensible to mirror Here are the flags it has in relation to how you connect to the API server:
On that note, our existing |
Thanks, that's very complete but overkill IMHO. Won't a kubeconfig file do ? |
Yes, that a good idea. The |
Ah, I can be indeed. |
👍 For mirroring kubectl flags I like it how Prometheus handles this too:
Kubeconfig is doable, but more complicated to get started. |
@2opremio for the record, if you chose the loadingRules := &clientcmd.ClientConfigLoadingRules{ExplicitPath: kube.ConfigPath}
configOverrides := &clientcmd.ConfigOverrides{}
kubeconfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)
config, err := kubeconfig.ClientConfig()
if err != nil {
return err
} Which wasn't obvious from the docs and took me a while to figure out. See the rest of the code for more context. |
I am a bit reluctant to provide separate config flags since I only envision custom client configurations in rare cases and kubeconfig fulfills all the possibilites. In addition it is safer to provide the configurations as a k8s secret instead of flags. Would it be too much of a hassle? |
I usually use configmaps when the config is quite large and it is faster to update the configmap than relaunch the pods. In Scope case I don't think it would auto-reload on configmap/secret change(it requires relaunching all daemonsets). For smaller configs and particularly daemonsets I prefer specifying flags. I have to agree though this is an edge case. |
OK, I will bite the bullet and implement all the flags :) |
Based on the testing this morning it looks like it doesn't respect the options anymore. I run scope with:
and get this in probe logs:
|
@mindfulmonk server expects an address + port (without the https part). Can you please try with |
Without the https:// it still gives:
|
Uhm, let me take a deeper look. |
@mindfulmonk it seems that |
Sure, can you let me know the flag and what it expects as param? |
@mindfulmonk |
In fact, it's |
It is still trying to go through 192.168.0.1 (kubernetes service IP) and not the one specified.
|
Alright, let's stop rushing. I will look into this properly before bothering you any further. Sorry for the inconvenience. |
@mindfulmonk It should work now both providing kubeconfig and insecure-skip-tls-verify. Please test with For the record: It was a nasty problem in config merging, partly due to Go's recursive vendoring limitations. I had to fetch a kubernetes dependency ( Sorry for the confusion. |
BTW, I was wrong about this:
It works perfectly fine with |
Closed via #1813 |
One user found that due to their in-cluster networking, they had to specify
--probe.kubernetes.api=https://loadbalanced-k8s-api.mycorp.com:8443
. When this was enabled, the k8s client in the scope probe forgot about the CA cert that was available in the pod secrets, and errored out withx509: certificate signed by unknown authority
.Let's find a way to allow the user to specify that they should use the in-pod secret with an override on the API URL.
cc @2opremio @errordeveloper
The text was updated successfully, but these errors were encountered: