Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
82044e62
Commit
82044e62
authored
Apr 27, 2015
by
Paul Morie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add docs for downward API
parent
0c611370
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
downward_api.md
docs/downward_api.md
+60
-0
No files found.
docs/downward_api.md
0 → 100644
View file @
82044e62
# Downward API
The downward API allows containers to consume information about the system without coupling to the
kubernetes client or REST API.
### Capabilities
Containers can consume the following information via the downward API:
*
Their pod's name
*
Their pod's namespace
### Consuming information about a pod in a container
Containers consume information from the downward API using environment variables. In the future,
containers will also be able to consume the downward API via a volume plugin. The
`valueFrom`
field of an environment variable allows you to specify an
`ObjectFieldSelector`
to select fields
from the pod's definition. The
`ObjectFieldSelector`
has an
`apiVersion`
field and a
`fieldPath`
field. The
`fieldPath`
field is an expression designating a field on the pod. The
`apiVersion`
field is the version of the API schema that the
`fieldPath`
is written in terms of. If the
`apiVersion`
field is not specified it is defaulted to the API version of the enclosing object.
### Example: consuming the downward API
This is an example of a pod that consumes its name and namespace via the downward API:
```
json
{
"apiVersion"
:
"v1beta3"
,
"name"
:
"downward-api-pod"
,
"kind"
:
"Pod"
,
"spec"
:
{
"manifest"
:
{
"containers"
:
[{
"name"
:
"example-container"
,
"image"
:
"gcr.io/google_containers/busybox"
,
"command"
:
[
"sh"
,
"-c"
,
"env"
]
"env"
:
[{
"name"
:
"POD_NAMESPACE"
,
"valueFrom"
:
{
"fieldPath"
:
{
"apiVersion"
:
"v1beta3"
,
"fieldPath"
:
"metadata.namespace"
}
}
},
{
"name"
:
"POD_NAME"
,
"valueFrom"
:
{
"fieldPath"
:
{
"apiVersion"
:
"v1beta3"
,
"fieldPath"
:
"metadata.name"
}
}
}]
}]
}
}
}]
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment