Created
March 24, 2018 15:04
-
-
Save neshmi/7c905903cc32e2742c81e11cd713ac15 to your computer and use it in GitHub Desktop.
Force kubectl to refresh auth
This file contains 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
#!/usr/bin/env ruby | |
require 'yaml' | |
kube_config = File.join(ENV["HOME"],".kube","config") | |
yaml = YAML.load(File.open(kube_config)) | |
current_context = yaml["current-context"] | |
index = yaml["users"].find_index{|user| user["name"] == current_context} | |
yaml["users"][index]["user"]["auth-provider"]["config"]["expiry"] = Time.now.utc - 500 | |
File.open(kube_config, 'w') { |f| YAML.dump(yaml, f) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment