kube icon indicating copy to clipboard operation
kube copied to clipboard

Upstream K8s is moving GKE auth to the regular auth plugin infra

Open nightkr opened this issue 2 years ago • 1 comments

See https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke.

I wonder if this should also allow us to remove the special GKE handling?

Looks like this was deprecated in K8s 1.22 and is now being removed in 1.25: https://cloud.google.com/kubernetes-engine/docs/deprecations/auth-plugin

nightkr avatar Jun 17 '22 10:06 nightkr

Yeah, I'm glad we don't need to add/maintain provider-specific code anymore. I don't think the plugin depends on Kubernetes version, but I don't have a cluster older than 1.22 to test.

We should be able to remove:

https://github.com/kube-rs/kube/blob/4bb19fb365927db85a9854f90290dbe1ee35a9d8/kube-client/src/client/auth/mod.rs#L315-L316

and also remove OAuth (Google Application Credentials-based token source) which is part of the GCP provider:

https://github.com/kube-rs/kube/blob/4bb19fb365927db85a9854f90290dbe1ee35a9d8/kube-client/src/client/auth/mod.rs#L154-L155


For one of my clusters, the new config looks like this:

users:
- name: with-auth-plugin
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args: null
      command: /path/to/gke-gcloud-auth-plugin
      env: null
      installHint: Install gke-gcloud-auth-plugin for use with kubectl by following
        go/gke-kubectl-exec-auth
      interactiveMode: IfAvailable
      provideClusterInfo: true

We probably need to change ExecConfig to an enum tagged by apiVersion (which shouldn't be optional here):

https://github.com/kube-rs/kube/blob/4bb19fb365927db85a9854f90290dbe1ee35a9d8/kube-client/src/config/file_config.rs#L226-L235

to support client.authentication.k8s.io/v1.


I think we can also close https://github.com/kube-rs/kube/issues/501 for https://github.com/Azure/kubelogin

kazk avatar Jun 17 '22 21:06 kazk