The software described in this documentation is either no longer supported or is in extended support.
Oracle recommends that you upgrade to a current supported release.
To use the kubectl command as a regular user, perform the following steps on the master node.
To setup kubectl on a master node:
- Create the - .kubesubdirectory in your home directory:- $ - mkdir -p $HOME/.kube
- Create a copy of the Kubernetes - admin.conffile in the- .kubedirectory:- $ - sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
- Change the ownership of the file to match your regular user profile: - $ - sudo chown $(id -u):$(id -g) $HOME/.kube/config
- Export the path to the file for the - KUBECONFIGenvironment variable:- $ - export KUBECONFIG=$HOME/.kube/config- To permanently set this environment variable, add it to your - .bashrcfile.- $ - echo 'export KUBECONFIG=$HOME/.kube/config' >> $HOME/.bashrc
- Verify that you can use the kubectl command. - Kubernetes runs many of its services to manage the cluster configuration as containers running as Kubernetes pods, which can be viewed by running the following command on a master node: - $ - kubectl get pods -n kube-systemNAME READY STATUS RESTARTS AGE coredns-5bc65d7f4b-qzfcc 1/1 Running 0 23h coredns-5bc65d7f4b-z64f2 1/1 Running 0 23h etcd-master1.example.com 1/1 Running 0 23h kube-apiserver-master1.example.com 1/1 Running 0 23h kube-controller-master1.example.com 1/1 Running 0 23h kube-flannel-ds-2sjbx 1/1 Running 0 23h kube-flannel-ds-njg9r 1/1 Running 0 23h kube-proxy-m2rt2 1/1 Running 0 23h kube-proxy-tbkxd 1/1 Running 0 23h kube-scheduler-master1.example.com 1/1 Running 0 23h kubernetes-dashboard-7646bf6898-d6x2m 1/1 Running 0 23h

