docs migration: Container Lifecycle Hooks into Concepts (#2564)
* initial commit for structure * migrate Container Lifecycle Hooks and related files to Concepts * update Concepts ToC * fix formatting * Formatting tweaks * comment out What's next * remove What's next * Begin rewrite of container-lifecycle-hooks.md * incremental update to edit * Split Container Lifecycle Hooks into container-lifecycle-hooks.md and container-environment.md; change all referring links. * Add concept template to volumes.md and images.md * Apply changes for steveperry-53 feedback. * fix format issue * tweak formatting * fix Concepts ToC * update links * add back changes to Concepts ToC * fix a link * update links
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
---
|
||||
assignees:
|
||||
- mikedanese
|
||||
- thockin
|
||||
title: Container Environment Variables
|
||||
---
|
||||
|
||||
{% capture overview %}
|
||||
|
||||
This page describes the resources available to Containers in the Container environment.
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{:toc}
|
||||
|
||||
{% capture body %}
|
||||
|
||||
## Container environment
|
||||
|
||||
The Kubernetes Container environment provides several important resources to Containers:
|
||||
|
||||
* A filesystem, which is a combination of an [image](/docs/concepts/containers/images) and one or more [volumes](/docs/concepts/storage/volumes).
|
||||
* Information about the Container itself.
|
||||
* Information about other objects in the cluster.
|
||||
|
||||
### Container information
|
||||
|
||||
The *hostname* of a Container is the name of the Pod in which the Container is running.
|
||||
It is available through the `hostname` command or the
|
||||
[`gethostname`](http://man7.org/linux/man-pages/man2/gethostname.2.html)
|
||||
function call in libc.
|
||||
|
||||
The Pod name and namespace are available as environment variables through the
|
||||
[downward API](docs/tasks/configure-pod-container/downward-api-volume-expose-pod-information).
|
||||
|
||||
User defined environment variables from the Pod definition are also available to the Container,
|
||||
as are any environment variables specified statically in the Docker image.
|
||||
|
||||
### Cluster information
|
||||
|
||||
A list of all services that were running when a Container was created are available to that Container as environment variables.
|
||||
Those environment variables match the syntax of Docker links.
|
||||
|
||||
For a service named *foo* that maps to a container port named *bar*,
|
||||
the following variables are defined:
|
||||
|
||||
```shell
|
||||
FOO_SERVICE_HOST=<the host the service is running on>
|
||||
FOO_SERVICE_PORT=<the port the service is running on>
|
||||
```
|
||||
|
||||
Services have dedicated IP addresses and are available to the Container via DNS,
|
||||
if [DNS addon](http://releases.k8s.io/{{page.githubbranch}}/cluster/addons/dns/) is enabled.
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{% capture whatsnext %}
|
||||
|
||||
* Learn more about [Container lifecycle hooks](/docs/concepts/containers/container-lifecycle-hooks.md).
|
||||
* Get hands-on experience
|
||||
[attaching handlers to Container lifecycle events](/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/).
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{% include templates/concept.md %}
|
||||
Reference in New Issue
Block a user