* 'master' of https://github.com/kubernetes/kubernetes.github.io:
  Updaated install-kubeadm.md, removed redundant kubectl installation (#4006)
  Add Chocolatey Package Manager for Windows (#4000)
  Make issue title automatically a link
  Update directions for macOS bash completion
This commit is contained in:
Andrew Chen
2017-06-07 09:57:05 -07:00
3 changed files with 39 additions and 22 deletions
+1 -1
View File
@@ -65,7 +65,7 @@
(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/js/rating/rating.js':'http://i0.poll.fm/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-rating-js'));
</script>
<a href="" onclick="window.open('https://github.com/kubernetes/kubernetes.github.io/issues/new?title=Issue%20with%20' +
window.location.pathname)" class="button issue">Create an Issue</a>
'k8s.io'+window.location.pathname)" class="button issue">Create an Issue</a>
<a href="/editdocs#{{ page.path }}" class="button issue">Edit this Page</a>
{% endif %}
</div>
+2 -2
View File
@@ -63,7 +63,7 @@ For each machine:
apt-get update
# Install docker if you don't have it already.
apt-get install -y docker-engine
apt-get install -y kubelet kubeadm kubectl kubernetes-cni
apt-get install -y kubelet kubeadm kubernetes-cni
```
* If the machine is running CentOS, run:
@@ -80,7 +80,7 @@ For each machine:
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y docker kubelet kubeadm kubectl kubernetes-cni
yum install -y docker kubelet kubeadm kubernetes-cni
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
```
+36 -19
View File
@@ -7,14 +7,14 @@ redirect_from:
- "/docs/tasks/kubectl/install/"
- "/docs/tasks/kubectl/install.html"
- "/docs/user-guide/prereqs/"
- "/docs/user-guide/prereqs.html"
- "/docs/user-guide/prereqs.html"
---
{% capture overview %}
Use the Kubernetes command-line tool, [kubectl](/docs/user-guide/kubectl), to deploy and manage applications on Kubernetes. Using kubectl, you can inspect cluster resources; create, delete, and update components; and look at your new cluster and bring up example apps.
{% endcapture %}
{% capture prerequisites %}
Use a version of kubectl that is the same version as your server or later. Using an older kubectl with a newer server might produce validation errors.
Use a version of kubectl that is the same version as your server or later. Using an older kubectl with a newer server might produce validation errors.
{% endcapture %}
Here are a few methods to install kubectl.
@@ -26,7 +26,7 @@ Here are a few methods to install kubectl.
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
To download a specific version, replace the `$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)` portion of the command with the specific version.
To download a specific version, replace the `$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)` portion of the command with the specific version.
For example, to download version {{page.fullversion}} on MacOS, type:
@@ -38,7 +38,7 @@ Here are a few methods to install kubectl.
chmod +x ./kubectl
```
3. Move the binary in to your PATH.
3. Move the binary in to your PATH.
```
sudo mv ./kubectl /usr/local/bin/kubectl
@@ -50,9 +50,9 @@ Here are a few methods to install kubectl.
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
To download a specific version, replace the `$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)` portion of the command with the specific version.
To download a specific version, replace the `$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)` portion of the command with the specific version.
For example, to download version {{page.fullversion}} on Linux, type:
For example, to download version {{page.fullversion}} on Linux, type:
curl -LO https://storage.googleapis.com/kubernetes-release/release/{{page.fullversion}}/bin/linux/amd64/kubectl
@@ -62,7 +62,7 @@ Here are a few methods to install kubectl.
chmod +x ./kubectl
```
3. Move the binary in to your PATH.
3. Move the binary in to your PATH.
```
sudo mv ./kubectl /usr/local/bin/kubectl
@@ -97,7 +97,7 @@ kubectl can be installed as part of the Google Cloud SDK.
gcloud components install kubectl
```
3. Run `kubectl version` to verify that the verison you've installed is sufficiently up-to-date.
## Install with Homebrew on macOS
1. If you are on macOS and using [Homebrew](https://brew.sh/) package manager, you can install with:
@@ -106,6 +106,22 @@ brew install kubectl
```
2. Run `kubectl version` to verify that the verison you've installed is sufficiently up-to-date.
## Install with Chocolatey on Windows
1. If you are on Windows and using [Chocolatey](https://chocolatey.org) package manager, you can install with:
```shell
choco install kubernetes-cli
```
2. Run `kubectl version` to verify that the verison you've installed is sufficiently up-to-date.
3. Configure kubectl to use a remote kubernetes cluster:
```shell
cd C:\users\yourusername (Or wherever your %HOME% directory is)
mkdir .kube
cd .kube
touch config
```
Edit the config file with a text editor of your choice, such as Notepad for example.
## Configuring kubectl
In order for kubectl to find and access a Kubernetes cluster, it needs a [kubeconfig file](/docs/concepts/cluster-administration/authenticate-across-clusters-kubeconfig/), which is created automatically when you create a cluster using kube-up.sh or successfully deploy a Minikube cluster. See the [getting started guides](/docs/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](/docs/tasks/administer-cluster/share-configuration/).
@@ -117,7 +133,7 @@ Check that kubectl is properly configured by getting the cluster state:
```shell
$ kubectl cluster-info
```
If you see a URL response, kubectl is correctly configured to access your cluster.
If you see a URL response, kubectl is correctly configured to access your cluster.
If you see a message similar to the following, kubectl is not correctly configured:
```shell
@@ -142,28 +158,29 @@ echo "source <(kubectl completion bash)" >> ~/.bashrc
```
### On macOS, using bash
On macOS, autocompletion works if you install using `brew install kubectl`,
and not if you downloaded kubectl directly.
Install the bash-completion support:
On macOS, you will need to install bash-completion support via [Homebrew](https://brew.sh/) first:
```shell
## If running Bash 3.2 included with macOS
brew install bash-completion
## or, if running Bash 4.1+
bash install bash-completion@2
```
To add kubectl autocompletion to your current shell, run:
Follow the "caveats" section of brew's output to add the appropriate bash completion path to your local .bashrc.
```shell
source $(brew --prefix)/etc/bash_completion
source <(kubectl completion bash)
```
If you've installed kubectl using the [Homebrew instructions](#install-with-homebrew-on-macos) then kubectl completion should start working immediately.
If you have installed kubectl manually, then run: `source <(kubectl completion bash)`
To add kubectl autocompletion to your profile (so it is automatically loaded in future shells):
```shell
echo "source $(brew --prefix)/etc/bash_completion" >> ~/.bash_profile
echo "source <(kubectl completion bash)" >> ~/.bash_profile
```
The Homebrew project is independent from kubernetes, so the bash-completion packages are not guaranteed to work.
{% endcapture %}
{% capture whatsnext %}
[Learn how to launch and expose your application.](/docs/user-guide/quick-start)