GithubHelp home page GithubHelp logo

vmax / kubectl-view-serviceaccount-kubeconfig-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from superbrothers/kubectl-view-serviceaccount-kubeconfig-plugin

0.0 0.0 0.0 7.07 MB

A kubectl plugin that show a kubeconfig to access the apiserver with a specified serviceaccount.

License: MIT License

Go 86.68% Makefile 13.32%

kubectl-view-serviceaccount-kubeconfig-plugin's Introduction

kubectl plugin view-serviceaccount-kubeconfig SERVICEACCOUNT

Show a kubeconfig setting for serviceaccount from bound token or secret-based token.

Note that in Kubernetes 1.24+, secret-based tokens are no longer auto-created by default for new service accounts. Using bound tokens created by "kubectl create token" command to access the Kubernetes API is recommended instead.

See Configure Service Accounts for Pods | Kubernetes for more information.

Usage:
  kubectl view-serviceaccount-kubeconfig [SERVICEACCOUNT] [options] [flags]

Examples:
  # Show a kubeconfig setting using bound token for serviceaccount/myapp in the current namespace
  kubectl create token myapp | kubectl view-serviceaccount-kubeconfig

  # Show a kubeconfig setting using bound token for a serviceaccount in a custom namspcae
  kubectl create token myapp --namespace myns | kubectl view-serviceaccount-kubeconfig

  # Show a kubeconfig setting using bound token with a custom expiration
  kubectl create token myapp --duration 10m | kubectl view-serviceaccount-kubeconfig

  # Show a kubeconfig setting using bound token in JSON format
  kubectl create token myapp | kubectl view-serviceaccount-kubeconfig --output json

  # Show a kubeconfig setting using secret-based token for serviceaccount/myapp in the current namespace
  kubectl view-serviceaccount-kubeconfig default

  # Show a kubeconfig setting using secret-based token for serviceaccount/bot in namespace/kube-system
  kubectl view-serviceaccount-kubeconfig bot -n kube-system

Try the plugin

# create a serviceaccount "myapp" in the current namespace
$ kubectl create serviceaccount myapp

# save a kubeconfig setting for serviceaccount "myapp"
$ kubectl create token myapp | kubectl view-serviceaccount-kubeconfig >./kubeconfig

# list pods as serviceaccount "myapp" from outside of kubernetes cluster
$ kubectl get pods --kubeconfig=./kubeconfig

Install the plugin

  1. Install krew that is a plugin manager for kubectl.

  2. Run:

     kubectl krew install view-serviceaccount-kubeconfig
    
  3. Try it out:

     kubectl view-serviceaccount-kubeconfig default
    

License

This software is released under the MIT License.

kubectl-view-serviceaccount-kubeconfig-plugin's People

Contributors

superbrothers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.