Last active
          July 25, 2018 14:04 
        
      - 
      
 - 
        
Save mgiacomini/70a2829aa5d1fd11a583c422fa28e989 to your computer and use it in GitHub Desktop.  
    How retrieve Kubernetes access token to current cluster (context)
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Check if the current cluster is right | |
| kubectl config current-context | |
| # Get the current context access token | |
| TOKEN=$(kubectl describe secret $(kubectl get secrets | grep ^default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d " ") | |
| # Print it :) | |
| echo $TOKEN | |
| # More info: https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/ | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment