Put orphaned topics in TOC. (#6051)
This commit is contained in:
@@ -1,106 +0,0 @@
|
||||
# ConfigMap example
|
||||
|
||||
|
||||
|
||||
## Step Zero: Prerequisites
|
||||
|
||||
This example assumes you have a Kubernetes cluster installed and running, and that you have
|
||||
installed the `kubectl` command line tool somewhere in your path. Please see [pick the right solution
|
||||
started](/docs/setup/pick-right-solution/) for installation instructions for your platform.
|
||||
|
||||
## Step One: Create the ConfigMap
|
||||
|
||||
A ConfigMap contains a set of named strings.
|
||||
|
||||
Use the [`configmap.yaml`](configmap.yaml) file to create a ConfigMap:
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/configmap/configmap.yaml
|
||||
```
|
||||
|
||||
You can use `kubectl` to see information about the ConfigMap:
|
||||
|
||||
```shell
|
||||
$ kubectl get configmap
|
||||
NAME DATA AGE
|
||||
test-configmap 2 6s
|
||||
|
||||
$ kubectl describe configMap test-configmap
|
||||
Name: test-configmap
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
|
||||
Data
|
||||
====
|
||||
data-1: 7 bytes
|
||||
data-2: 7 bytes
|
||||
```
|
||||
|
||||
View the values of the keys with `kubectl get`:
|
||||
|
||||
```shell
|
||||
$ kubectl get configmaps test-configmap -o yaml
|
||||
apiVersion: v1
|
||||
data:
|
||||
data-1: value-1
|
||||
data-2: value-2
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: 2016-02-18T20:28:50Z
|
||||
name: test-configmap
|
||||
namespace: default
|
||||
resourceVersion: "1090"
|
||||
selfLink: /api/v1/namespaces/default/configmaps/test-configmap
|
||||
uid: 384bd365-d67e-11e5-8cd0-68f728db1985
|
||||
```
|
||||
|
||||
## Step Two: Create a pod that consumes a configMap in environment variables
|
||||
|
||||
Use the [`env-pod.yaml`](env-pod.yaml) file to create a Pod that consumes the
|
||||
ConfigMap in environment variables.
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/configmap/env-pod.yaml
|
||||
```
|
||||
|
||||
This pod runs the `env` command to display the environment of the container:
|
||||
|
||||
```shell
|
||||
$ kubectl logs config-env-test-pod | grep KUBE_CONFIG
|
||||
KUBE_CONFIG_1=value-1
|
||||
KUBE_CONFIG_2=value-2
|
||||
```
|
||||
|
||||
## Step Three: Create a pod that sets the command line using ConfigMap
|
||||
|
||||
Use the [`command-pod.yaml`](command-pod.yaml) file to create a Pod with a container
|
||||
whose command is injected with the keys of a ConfigMap:
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/configmap/command-pod.yaml
|
||||
```
|
||||
|
||||
This pod runs an `echo` command to display the keys:
|
||||
|
||||
```shell
|
||||
$ kubectl logs config-cmd-test-pod
|
||||
value-1 value-2
|
||||
```
|
||||
|
||||
## Step Four: Create a pod that consumes a configMap in a volume
|
||||
|
||||
Pods can also consume ConfigMaps in volumes. Use the [`volume-pod.yaml`](volume-pod.yaml) file to create a Pod that consumes the ConfigMap in a volume.
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/configmap/volume-pod.yaml
|
||||
```
|
||||
|
||||
This pod runs a `cat` command to print the value of one of the keys in the volume:
|
||||
|
||||
```shell
|
||||
$ kubectl logs config-volume-test-pod
|
||||
value-1
|
||||
```
|
||||
|
||||
Alternatively you can use [`mount-file-pod.yaml`](mount-file-pod.yaml) file to mount
|
||||
only a file from ConfigMap, preserving original content of /etc directory.
|
||||
@@ -1,52 +0,0 @@
|
||||
Following these examples, you will create a pod with a container that consumes the pod's name,
|
||||
namespace, and resource values using the [downward API](/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/).
|
||||
|
||||
## Step Zero: Prerequisites
|
||||
|
||||
This example assumes you have a Kubernetes cluster installed and running, and that you have
|
||||
installed the `kubectl` command line tool somewhere in your path. Please see [pick the right solution](/docs/setup/pick-right-solution/) for installation instructions for your platform.
|
||||
|
||||
## Step One: Create the pod
|
||||
|
||||
Containers consume the downward API using environment variables. The downward API allows
|
||||
containers to be injected with the name and namespace of the pod the container is in.
|
||||
|
||||
Use the [`dapi-pod.yaml`](dapi-pod.yaml) file to create a Pod with a container that consumes the
|
||||
downward API.
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/downward-api/dapi-pod.yaml
|
||||
```
|
||||
|
||||
### Examine the logs
|
||||
|
||||
This pod runs the `env` command in a container that consumes the downward API. You can grep
|
||||
through the pod logs to see that the pod was injected with the correct values:
|
||||
|
||||
```shell
|
||||
$ kubectl logs dapi-test-pod | grep POD_
|
||||
2015-04-30T20:22:18.568024817Z MY_POD_NAME=dapi-test-pod
|
||||
2015-04-30T20:22:18.568087688Z MY_POD_NAMESPACE=default
|
||||
2015-04-30T20:22:18.568092435Z MY_POD_IP=10.0.1.6
|
||||
```
|
||||
|
||||
## Example of environment variables with container resources
|
||||
|
||||
Use the [`dapi-container-resources.yaml`](dapi-container-resources.yaml) file to create a Pod
|
||||
with a container that consumes the downward API exposing the container's resources.
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/user-guide/downward-api/dapi-container-resources.yaml
|
||||
```
|
||||
|
||||
### Examine the logs
|
||||
|
||||
Grep through the pod logs to see that the pod was injected with the correct values:
|
||||
|
||||
```shell
|
||||
$ kubectl logs dapi-test-pod | grep MY_
|
||||
MY_MEM_LIMIT=67108864
|
||||
MY_CPU_LIMIT=1
|
||||
MY_MEM_REQUEST=33554432
|
||||
MY_CPU_REQUEST=1
|
||||
```
|
||||
@@ -1 +0,0 @@
|
||||
This image has moved to https://github.com/kubernetes/kubernetes/tree/master/test/images/liveness
|
||||
@@ -1,58 +0,0 @@
|
||||
To view a specific pod, use the `kubectl get` command:
|
||||
|
||||
```shell
|
||||
$ kubectl get pod NAME
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
example-1934187764-scau1 1/1 Running 0 2d
|
||||
```
|
||||
|
||||
To return the name of the node on which the pod is scheduled, use the `-o wide`
|
||||
option:
|
||||
|
||||
```shell
|
||||
$ kubectl get pod NAME -o wide
|
||||
NAME READY STATUS RESTARTS AGE NODE
|
||||
example-1934187764-scau1 1/1 Running 0 2d gke-example-c6a38-node-xij3
|
||||
```
|
||||
|
||||
For more details about a pod, including events, use `describe` in place of
|
||||
`get`:
|
||||
|
||||
```shell
|
||||
$ kubectl describe pod NAME
|
||||
Name: example-1934187764-scau1
|
||||
Namespace: default
|
||||
Image(s): kubernetes/example-php-redis:v2
|
||||
Node: gke-example-c6a38461-node-xij3/10.240.34.183
|
||||
Labels: name=frontend
|
||||
Status: Running
|
||||
Reason:
|
||||
Message:
|
||||
IP: 10.188.2.10
|
||||
Replication Controllers: example (5/5 replicas created)
|
||||
Containers:
|
||||
php-redis:
|
||||
Image: kubernetes/example-php-redis:v2
|
||||
Limits:
|
||||
cpu: 100m
|
||||
State: Running
|
||||
Started: Tue, 04 Aug 2015 09:02:46 -0700
|
||||
Ready: True
|
||||
Restart Count: 0
|
||||
Conditions:
|
||||
Type Status
|
||||
Ready True
|
||||
Events:
|
||||
FirstSeen LastSeen Coun From SubobjectPath Reason Message
|
||||
Thu, 06 Aug 2015 11:49:44 -0700 Thu, 06 Aug 2015 11:49:44 -0700 1 {kubelet gke-example-c6a38461-node-xij3} spec.containers{example} started Started with docker id 5705bffa65e2
|
||||
```
|
||||
|
||||
To list all pods running on a cluster:
|
||||
|
||||
```shell
|
||||
$ kubectl get pods
|
||||
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
example-1934187764-scau1 1/1 Running 0 1m
|
||||
frontend-7kdod 1/1 Running 0 1d
|
||||
```
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
approvers:
|
||||
- mikedanese
|
||||
- thockin
|
||||
|
||||
---
|
||||
### This document has been subsumed by [deploying-applications.md](/docs/user-guide/deploying-applications/)
|
||||
@@ -1 +0,0 @@
|
||||
This image has moved to https://github.com/kubernetes/kubernetes/tree/master/test/images/kitten
|
||||
@@ -1 +0,0 @@
|
||||
This image has moved to https://github.com/kubernetes/kubernetes/tree/master/test/images/nautilus
|
||||
Reference in New Issue
Block a user