Improved static pod task documentation (#16709)

Improved indentation

Apply suggestions from code review

Co-Authored-By: Zach Corleissen <zacharysarah@users.noreply.github.com>

Removing bullets points

Same have been added inline as per suggestions

Removed trailing space
This commit is contained in:
Manish Bansal
2019-10-10 13:54:54 +05:30
committed by Kubernetes Prow Robot
parent af66c0a274
commit d468afa016
@@ -48,7 +48,7 @@ Instructions for other distributions or Kubernetes installations may vary.
## Create a static pod {#static-pod-creation} ## Create a static pod {#static-pod-creation}
You can configure a static Pod two different ways: either by using configuration file(s) or by HTTP. You can configure a static Pod with either a [file system hosted configuration file](/docs/tasks/configure-pod-container/static-pod/#configuration-files) or a [web hosted configuration file](/docs/tasks/configure-pod-container/static-pod/#pods-created-via-http).
### Filesystem-hosted static Pod manifest {#configuration-files} ### Filesystem-hosted static Pod manifest {#configuration-files}
@@ -65,17 +65,17 @@ For example, this is how to start a simple web server as a static Pod:
2. Choose a directory, say `/etc/kubelet.d` and place a web server Pod definition there, e.g. `/etc/kubelet.d/static-web.yaml`: 2. Choose a directory, say `/etc/kubelet.d` and place a web server Pod definition there, e.g. `/etc/kubelet.d/static-web.yaml`:
```shell ```shell
# Run this command on the node where kubelet is running # Run this command on the node where kubelet is running
mkdir /etc/kubelet.d/ mkdir /etc/kubelet.d/
cat <<EOF >/etc/kubelet.d/static-web.yaml cat <<EOF >/etc/kubelet.d/static-web.yaml
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: static-web name: static-web
labels: labels:
role: myrole role: myrole
spec: spec:
containers: containers:
- name: web - name: web
image: nginx image: nginx
@@ -83,15 +83,15 @@ spec:
- name: web - name: web
containerPort: 80 containerPort: 80
protocol: TCP protocol: TCP
EOF EOF
``` ```
3. Configure your kubelet on the node to use this directory by running it with `--pod-manifest-path=/etc/kubelet.d/` argument or add the `staticPodPath: <the directory>` field in the [KubeletConfiguration file](/docs/tasks/administer-cluster/kubelet-config-file). 3. Configure your kubelet on the node to use this directory by running it with `--pod-manifest-path=/etc/kubelet.d/` argument. On Fedora edit `/etc/kubernetes/kubelet` to include this line:
On Fedora edit `/etc/kubernetes/kubelet` to include this line:
``` ```
KUBELET_ARGS="--cluster-dns=10.254.0.10 --cluster-domain=kube.local --pod-manifest-path=/etc/kubelet.d/" KUBELET_ARGS="--cluster-dns=10.254.0.10 --cluster-domain=kube.local --pod-manifest-path=/etc/kubelet.d/"
``` ```
or add the `staticPodPath: <the directory>` field in the [KubeletConfiguration file](/docs/tasks/administer-cluster/kubelet-config-file).
4. Restart the kubelet. On Fedora, you would run: 4. Restart the kubelet. On Fedora, you would run:
@@ -108,16 +108,18 @@ Similar to how [filesystem-hosted manifests](#configuration-files) work, the kub
refetches the manifest on a schedule. If there are changes to the list of static refetches the manifest on a schedule. If there are changes to the list of static
Pods, the kubelet applies them. Pods, the kubelet applies them.
If you want to use this approach, create a YAML file: To use this approach:
```yaml 1. Create a YAML file and store it on a web server so that you can pass the URL of that file to the kubelet.
apiVersion: v1
kind: Pod ```yaml
metadata: apiVersion: v1
kind: Pod
metadata:
name: static-web name: static-web
labels: labels:
role: myrole role: myrole
spec: spec:
containers: containers:
- name: web - name: web
image: nginx image: nginx
@@ -125,27 +127,23 @@ spec:
- name: web - name: web
containerPort: 80 containerPort: 80
protocol: TCP protocol: TCP
``` ```
and store it on a web server so that you can pass the URL of that file to the kubelet.
Configure the kubelet on your selected node to use this web manifest by running it with `--manifest-url=<manifest-url>`
On Fedora, edit `/etc/kubernetes/kubelet` to include this line:
```
KUBELET_ARGS="--cluster-dns=10.254.0.10 --cluster-domain=kube.local --manifest-url=<manifest-url>`
```
Now, restart the kubelet. On Fedora, you would run:
```shell
# Run this command on the node where the kubelet is running
systemctl restart kubelet
```
2. Configure the kubelet on your selected node to use this web manifest by running it with `--manifest-url=<manifest-url>`. On Fedora, edit `/etc/kubernetes/kubelet` to include this line:
```
KUBELET_ARGS="--cluster-dns=10.254.0.10 --cluster-domain=kube.local --manifest-url=<manifest-url>`
```
3. Restart the kubelet. On Fedora, you would run:
```shell
# Run this command on the node where the kubelet is running
systemctl restart kubelet
```
## Observe static pod behavior {#behavior-of-static-pods} ## Observe static pod behavior {#behavior-of-static-pods}
When the kubelet starts, it automatically starts all defined static Pods. As you have When the kubelet starts, it automatically starts all defined static Pods. As you have