To deploy and manage applications on Kubernetes, you’ll use the Kubernetes command-line tool, kubectl. It lets you inspect your cluster resources, create, delete, and update components, and much more. You will use it to look at your new cluster and bring up example apps.
You can find it in the release tar bundle, under platforms//; or if you build from source, kubectl should be either under _output/local/bin// or _output/dockerized/bin//.
Next, make sure the kubectl tool is in your path, assuming you download a release:
# OS X
export PATH=<path/to/kubernetes-directory>/platforms/darwin/amd64:$PATH
# Linux
export PATH=<path/to/kubernetes-directory>/platforms/linux/amd64:$PATH
In order for kubectl to find and access the Kubernetes cluster, it needs a kubeconfig file, which is created automatically when creating a cluster using kube-up.sh (see the getting started guides for more about creating clusters). If you need access to a cluster you didn’t create, see the Sharing Cluster Access document.
If you downloaded a pre-compiled release, kubectl should be under platforms/<os>/<arch>
.
If you built from source, kubectl should be either under _output/local/bin/<os>/<arch>
or _output/dockerized/bin/<os>/<arch>
.
The kubectl binary doesn't have to be installed to be executable, but the rest of the walkthrough will assume that it's in your PATH.
The simplest way to install is to copy or move kubectl into a dir already in PATH (e.g. /usr/local/bin
). For example:
# OS X
$ sudo cp kubernetes/platforms/darwin/amd64/kubectl /usr/local/bin/kubectl
# Linux
$ sudo cp kubernetes/platforms/linux/amd64/kubectl /usr/local/bin/kubectl
If you used ./cluster/kube-up.sh
to deploy your Kubernetes cluster, kubectl should already be locally configured.
By default, kubectl configuration lives at ~/.kube/config
.
If your cluster was deployed by other means (e.g. a getting started guide) your kubectl client will typically be configured during that process. If for some reason your kubectl client is not yet configured, check out kubeconfig-file.md.
Check that kubectl is properly configured by getting the cluster state:
$ kubectl cluster-info
If you see a url response, you are ready to go.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。