{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16085","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16085/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16085/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16085/events","html_url":"https://github.com/kubernetes/kubernetes/issues/16085","id":112723554,"number":16085,"title":"How do I get to know the config context (default (preference) namespace etc)","user":{"login":"feihujiang","id":2322270,"avatar_url":"https://avatars.githubusercontent.com/u/2322270?v=3","gravatar_id":"","url":"https://api.github.com/users/feihujiang","html_url":"https://github.com/feihujiang","followers_url":"https://api.github.com/users/feihujiang/followers","following_url":"https://api.github.com/users/feihujiang/following{/other_user}","gists_url":"https://api.github.com/users/feihujiang/gists{/gist_id}","starred_url":"https://api.github.com/users/feihujiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feihujiang/subscriptions","organizations_url":"https://api.github.com/users/feihujiang/orgs","repos_url":"https://api.github.com/users/feihujiang/repos","events_url":"https://api.github.com/users/feihujiang/events{/privacy}","received_events_url":"https://api.github.com/users/feihujiang/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/component/kubectl","name":"component/kubectl","color":"0052cc"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/priority/P2","name":"priority/P2","color":"fbca04"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/team/ux","name":"team/ux","color":"d2b48c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-22T03:17:52Z","updated_at":"2016-02-01T07:00:14Z","closed_at":null,"body":"I found that kubectl namespace has been forbidden: and if I use ```kubectl namespace```, there is a clue that  \"See 'kubectl config set-context --help' for more details\"\r\nBut ```kubectl config set-context``` couldn't view the default (preference) namespace.\r\nThen I use  ```kubectl config view```, but the result is:\r\n~~~\r\n{\r\n    \"kind\": \"Config\",\r\n    \"apiVersion\": \"v1\",\r\n    \"preferences\": {},\r\n    \"clusters\": [],\r\n    \"users\": [],\r\n    \"contexts\": [],\r\n    \"current-context\": \"\"\r\n}\r\n~~~\r\nI couldn't found any contexts there.\r\nSo I see, If we don't specify any context,  The current-context (default namespace etc) is hard coded in our code.\r\nI think this is a bad user experience. We should enhance this.\r\n\r\nAnd I specify a current-context, use  ```kubectl config view``` again, the result is:\r\n~~~\r\napiVersion: v1\r\nclusters: []\r\ncontexts:\r\n- context:\r\n    cluster: \"\"\r\n    namespace: development\r\n    user: \"\"\r\n  name: development\r\ncurrent-context: development\r\nkind: Config\r\npreferences: {}\r\nusers: []\r\n~~~~\r\nYes, it works. But I think we should support ```kubectl config view --current-context``` to see the current-context directly.\r\n\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/177814873","html_url":"https://github.com/kubernetes/kubernetes/issues/16085#issuecomment-177814873","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/16085","id":177814873,"user":{"login":"feihujiang","id":2322270,"avatar_url":"https://avatars.githubusercontent.com/u/2322270?v=3","gravatar_id":"","url":"https://api.github.com/users/feihujiang","html_url":"https://github.com/feihujiang","followers_url":"https://api.github.com/users/feihujiang/followers","following_url":"https://api.github.com/users/feihujiang/following{/other_user}","gists_url":"https://api.github.com/users/feihujiang/gists{/gist_id}","starred_url":"https://api.github.com/users/feihujiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feihujiang/subscriptions","organizations_url":"https://api.github.com/users/feihujiang/orgs","repos_url":"https://api.github.com/users/feihujiang/repos","events_url":"https://api.github.com/users/feihujiang/events{/privacy}","received_events_url":"https://api.github.com/users/feihujiang/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T07:00:14Z","updated_at":"2016-02-01T07:00:14Z","body":"It addresses my problem partially. But ```kubectl config current-context``` just only output the name of current-context. \r\nFor example:\r\n~~~\r\n# ./cluster/kubectl.sh config current-context\r\ndefault\r\n~~~\r\nThe first problem is the output ```default``` means what? (I look into the codes, and know it means the name of current-context. )\r\nThe second problem is it doesn't output the details of the current-context. If I want to know the details of the current-context, I should use ```./cluster/kubectl.sh config view```. and found the context named ```default```.\r\n~~~~\r\n# ./cluster/kubectl.sh config view\r\napiVersion: v1\r\nclusters: []\r\ncontexts:\r\n- context:\r\n    cluster: \"\"\r\n    namespace: default\r\n    user: \"\"\r\n  name: default\r\n- context:\r\n    cluster: \"\"\r\n    namespace: prod\r\n    user: \"\"\r\n  name: prod\r\ncurrent-context: default\r\nkind: Config\r\npreferences: {}\r\nusers: []\r\n~~~\r\nI advice we should output the details of current context as follows:\r\n~~~\r\n# ./cluster/kubectl.sh config current-context\r\ncurrent-context:\r\n  name: default\r\n    cluster: \"\"\r\n    namespace: default\r\n    user: \"\"\r\n~~~\r\n\r\n@bgrant0607 What's your point?\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}