Merge pull request #1309 from steveperry-53/templates3
Write page templates and canonical examples.
This commit is contained in:
		
						commit
						3dc9f20d49
					
				| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
bigheader: "Concepts"
 | 
			
		||||
toc:
 | 
			
		||||
- title: Concepts
 | 
			
		||||
  path: /docs/concepts/
 | 
			
		||||
- title: Object Metadata
 | 
			
		||||
  section:
 | 
			
		||||
  - title: Annotations
 | 
			
		||||
    path: /docs/concepts/object-metadata/annotations/
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,8 @@
 | 
			
		|||
tocs:
 | 
			
		||||
- guides
 | 
			
		||||
- tutorials
 | 
			
		||||
- tasks
 | 
			
		||||
- concepts
 | 
			
		||||
- reference
 | 
			
		||||
- samples
 | 
			
		||||
- support
 | 
			
		||||
- support
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,11 @@ toc:
 | 
			
		|||
- title: Support
 | 
			
		||||
  path: /docs/troubleshooting/
 | 
			
		||||
 | 
			
		||||
- title: Contributing to the Kubernetes Docs
 | 
			
		||||
  section:
 | 
			
		||||
  - title: Using Page Templates
 | 
			
		||||
    path: /docs/contribute/page-templates/
 | 
			
		||||
 | 
			
		||||
- title: Troubleshooting
 | 
			
		||||
  section:
 | 
			
		||||
  - title: Debugging Pods and Replication Controllers
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
bigheader: "Tasks"
 | 
			
		||||
toc:
 | 
			
		||||
- title: Tasks
 | 
			
		||||
  path: /docs/tasks/
 | 
			
		||||
- title: Accessing Applications in a Cluster
 | 
			
		||||
  section:
 | 
			
		||||
  - title: Using Port Forwarding to Access Applications in a Cluster
 | 
			
		||||
    path: /docs/tasks/access-application-cluster/port-forward-access-application-cluster/
 | 
			
		||||
- title: Accessing the Kubernetes API
 | 
			
		||||
  section:
 | 
			
		||||
  - title: Using an HTTP Proxy to Access the Kubernetes API
 | 
			
		||||
    path: /docs/tasks/access-kubernetes-api/http-proxy-access-api/
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
bigheader: "Tutorials"
 | 
			
		||||
toc:
 | 
			
		||||
- title: Tutorials
 | 
			
		||||
  path: /docs/tutorials/
 | 
			
		||||
- title: Stateless Applications
 | 
			
		||||
  section:
 | 
			
		||||
  - title: Running a Stateless Application Using a Deployment
 | 
			
		||||
    path: /docs/tutorials/stateless-application/run-stateless-application-deployment/
 | 
			
		||||
  - title: Exposing an External IP Address Using a Service 
 | 
			
		||||
    path: /docs/tutorials/stateless-application/expose-external-ip-address-service/
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
{% if overview %}
 | 
			
		||||
 | 
			
		||||
{{ overview }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='overview' purpose='provides an overview of this concept.' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
* TOC
 | 
			
		||||
{:toc}
 | 
			
		||||
 | 
			
		||||
{% if body %}
 | 
			
		||||
 | 
			
		||||
{{ body }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='body' purpose='supplies the body of the page content.' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if whatsnext %}
 | 
			
		||||
 | 
			
		||||
### What's next
 | 
			
		||||
 | 
			
		||||
{{ whatsnext }}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,36 +1,55 @@
 | 
			
		|||
{% if purpose %}
 | 
			
		||||
{% if overview %}
 | 
			
		||||
 | 
			
		||||
### Purpose
 | 
			
		||||
 | 
			
		||||
{{ purpose }}
 | 
			
		||||
{{ overview }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='purpose' heading='Purpose' purpose='states, in one sentence, what the purpose of this document is, so that the user will know what they are able to achieve if they follow the provided steps.' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% if recommended_background %}
 | 
			
		||||
 | 
			
		||||
### Recommended background
 | 
			
		||||
 | 
			
		||||
{{ recommended_background }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='recommended_background' heading='Recommended background' purpose='lists assumptions of baseline knowledge that you expect the user to have before reading ahead.' %}
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='overview' purpose='states, in one or two sentences, the purpose of this document' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if step_by_step %}
 | 
			
		||||
* TOC
 | 
			
		||||
{: toc}
 | 
			
		||||
 | 
			
		||||
### Step by step
 | 
			
		||||
 | 
			
		||||
{{ step_by_step }}
 | 
			
		||||
{% if prerequisites %}
 | 
			
		||||
 | 
			
		||||
### Before you begin
 | 
			
		||||
 | 
			
		||||
{{ prerequisites }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='step_by_step' heading='Step by step' purpose='lists a series of linear, numbered steps that accomplish the described task.' %}
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='prerequisites' heading='Before you begin' purpose='lists action prerequisites and knowledge prerequisites' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if steps %}
 | 
			
		||||
 | 
			
		||||
{{ steps }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='steps' purpose='lists a sequence of numbered steps that accomplish the task.' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if discussion %}
 | 
			
		||||
 | 
			
		||||
{{ discussion }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if whatsnext %}
 | 
			
		||||
 | 
			
		||||
### What's next
 | 
			
		||||
 | 
			
		||||
{{ whatsnext }}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,68 @@
 | 
			
		|||
{% if overview %}
 | 
			
		||||
 | 
			
		||||
{{ overview }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='overview' purpose='states, in one or two sentences, the purpose of this document' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* TOC
 | 
			
		||||
{: toc}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if objectives %}
 | 
			
		||||
 | 
			
		||||
### Objectives
 | 
			
		||||
 | 
			
		||||
{{ objectives }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='objectives' heading='Objectives' purpose='lists the objectives for this tutorial.' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if prerequisites %}
 | 
			
		||||
 | 
			
		||||
### Before you begin
 | 
			
		||||
 | 
			
		||||
{{ prerequisites }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='prerequisites' heading='Before you begin' purpose='lists action prerequisites and knowledge prerequisites' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if lessoncontent %}
 | 
			
		||||
 | 
			
		||||
{{ lessoncontent }}
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
{% include templates/_errorthrower.md missing_block='lessoncontent' purpose='provides the lesson content for this tutorial.' %}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if cleanup %}
 | 
			
		||||
 | 
			
		||||
### Cleaning up
 | 
			
		||||
 | 
			
		||||
{{ cleanup }}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% if whatsnext %}
 | 
			
		||||
 | 
			
		||||
### What's next
 | 
			
		||||
 | 
			
		||||
{{ whatsnext }}
 | 
			
		||||
 | 
			
		||||
{% endif %}
 | 
			
		||||
| 
						 | 
				
			
			@ -7,19 +7,22 @@
 | 
			
		|||
 | 
			
		||||
<!--  HERO  -->
 | 
			
		||||
<section id="hero" class="light-text">
 | 
			
		||||
	<h1>{{ site.data[foundTOC].bigheader }}</h1>
 | 
			
		||||
	<h5>{{ site.data[foundTOC].abstract }}</h5>
 | 
			
		||||
	<div id="vendorStrip" class="light-text">
 | 
			
		||||
		<ul>
 | 
			
		||||
			<li><a href="/docs/" {% if site.data[foundTOC].bigheader == "Guides" %}class="YAH"{% endif %}>GUIDES</a></li>
 | 
			
		||||
			<li><a href="/docs/reference" {% if site.data[foundTOC].bigheader == "Reference Documentation" %}class="YAH"{% endif %}>REFERENCE</a></li>
 | 
			
		||||
			<li><a href="/docs/samples" {% if site.data[foundTOC].bigheader == "Samples" %}class="YAH"{% endif %}>SAMPLES</a></li>
 | 
			
		||||
			<li><a href="/docs/troubleshooting/" {% if site.data[foundTOC].bigheader == "Support" %}class="YAH"{% endif %}>SUPPORT</a></li>
 | 
			
		||||
		</ul>
 | 
			
		||||
		<div id="searchBox">
 | 
			
		||||
			<input type="text" id="search" placeholder="Search" onkeydown="if (event.keyCode==13) window.location.replace('/docs/search/?q=' + this.value)">
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
  <h1>{{ site.data[foundTOC].bigheader }}</h1>
 | 
			
		||||
  <h5>{{ site.data[foundTOC].abstract }}</h5>
 | 
			
		||||
  <div id="vendorStrip" class="light-text">
 | 
			
		||||
    <ul>
 | 
			
		||||
      <li><a href="/docs/" {% if site.data[foundTOC].bigheader == "Guides" %}class="YAH"{% endif %}>GUIDES</a></li>
 | 
			
		||||
      <li><a href="/docs/tutorials/" {% if site.data[foundTOC].bigheader == "Tutorials" %}class="YAH"{% endif %}>TUTORIALS</a></li>
 | 
			
		||||
      <li><a href="/docs/tasks/" {% if site.data[foundTOC].bigheader == "Tasks" %}class="YAH"{% endif %}>TASKS</a></li>
 | 
			
		||||
      <li><a href="/docs/concepts/" {% if site.data[foundTOC].bigheader == "Concepts" %}class="YAH"{% endif %}>CONCEPTS</a></li>
 | 
			
		||||
      <li><a href="/docs/reference" {% if site.data[foundTOC].bigheader == "Reference Documentation" %}class="YAH"{% endif %}>REFERENCE</a></li>
 | 
			
		||||
      <li><a href="/docs/samples" {% if site.data[foundTOC].bigheader == "Samples" %}class="YAH"{% endif %}>SAMPLES</a></li>
 | 
			
		||||
      <li><a href="/docs/troubleshooting/" {% if site.data[foundTOC].bigheader == "Support" %}class="YAH"{% endif %}>SUPPORT</a></li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    <div id="searchBox">
 | 
			
		||||
      <input type="text" id="search" placeholder="Search" onkeydown="if (event.keyCode==13) window.location.replace('/docs/search/?q=' + this.value)">
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<section id="encyclopedia">
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +37,7 @@
 | 
			
		|||
    	{% if notitle != "true" %}<h1>{{ title }}</h1>{% endif %}
 | 
			
		||||
		{{ content }}
 | 
			
		||||
        <p><a href=""><img src="https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/{{ page.path }}?pixel" alt="Analytics" /></a>
 | 
			
		||||
        {% if page.url != "/404.html" && page.url != "/docs/search/" %}<div id="pd_rating_holder_8345992"></div>
 | 
			
		||||
        {% if page.url != "/404.html" and page.url != "/docs/search/" %}<div id="pd_rating_holder_8345992"></div>
 | 
			
		||||
		<script type="text/javascript">
 | 
			
		||||
	        PDRTJS_settings_8345992 = {
 | 
			
		||||
		        "id" : "8345992",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The Concepts section of the Kubernetes documentation is a work in progress.
 | 
			
		||||
 | 
			
		||||
#### Object Metadata
 | 
			
		||||
 | 
			
		||||
[Annotations](/docs/concepts/object-metadata/annotations/)
 | 
			
		||||
 | 
			
		||||
### What's next
 | 
			
		||||
 | 
			
		||||
If you would like to write a concept page, see
 | 
			
		||||
[Using Page Templates](/docs/contribute/page-templates/)
 | 
			
		||||
for information about the concept page type and the concept template.
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,60 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
You can use Kubernetes annotations to attach arbitrary non-identifying metadata
 | 
			
		||||
to objects. Clients such as tools and libraries can retrieve this metadata.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture body %}
 | 
			
		||||
### Attaching metadata to objects
 | 
			
		||||
 | 
			
		||||
You can use either labels or annotations to attach metadata to Kubernetes
 | 
			
		||||
objects. Labels can be used to select objects and to find
 | 
			
		||||
collections of objects that satisfy certain conditions. In contrast, annotations
 | 
			
		||||
are not used to identify and select objects. The metadata
 | 
			
		||||
in an annotation can be small or large, structured or unstructured, and can
 | 
			
		||||
include characters not permitted by labels.
 | 
			
		||||
 | 
			
		||||
Annotations, like labels, are key/value maps:
 | 
			
		||||
 | 
			
		||||
    "annotations": {
 | 
			
		||||
      "key1" : "value1",
 | 
			
		||||
      "key2" : "value2"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
Here are some examples of information that could be recorded in annotations:
 | 
			
		||||
 | 
			
		||||
* Fields managed by a declarative configuration layer. Attaching these fields
 | 
			
		||||
  as annotations distinguishes them from default values set by clients or
 | 
			
		||||
  servers, and from auto-generated fields and fields set by
 | 
			
		||||
  auto-sizing or auto-scaling systems.
 | 
			
		||||
 | 
			
		||||
* Build, release, or image information like timestamps, release IDs, git branch,
 | 
			
		||||
  PR numbers, image hashes, and registry address.
 | 
			
		||||
 | 
			
		||||
* Pointers to logging, monitoring, analytics, or audit repositories.
 | 
			
		||||
 | 
			
		||||
* Client library or tool information that can be used for debugging purposes:
 | 
			
		||||
  for example, name, version, and build information.
 | 
			
		||||
 | 
			
		||||
* User or tool/system provenance information, such as URLs of related objects
 | 
			
		||||
  from other ecosystem components.
 | 
			
		||||
 | 
			
		||||
* Lightweight rollout tool metadata: for example, config or checkpoints.
 | 
			
		||||
 | 
			
		||||
* Phone or pager numbers of persons responsible, or directory entries that
 | 
			
		||||
  specify where that information can be found, such as a team web site.
 | 
			
		||||
 | 
			
		||||
Instead of using annotations, you could store this type of in information in an
 | 
			
		||||
external database or directory, but that would make it much harder to produce
 | 
			
		||||
shared client libraries and tools for deployment, management, introspection,
 | 
			
		||||
and the like.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
Learn more about [Labels and Selectors](/docs/user-guide/labels/).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/concept.md %}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,205 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
<!--<html>
 | 
			
		||||
<body>-->
 | 
			
		||||
 | 
			
		||||
<p>These page templates are available for writers who would like to contribute new topics to the Kubernetes docs:</p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
    <li><a href="#task_template">Task</a></li>
 | 
			
		||||
    <li><a href="#tutorial_template">Tutorial</a></li>
 | 
			
		||||
    <li><a href="#concept_template">Concept</a></li>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<p>The page templates are in the <a href="https://github.com/kubernetes/kubernetes.github.io/tree/master/_includes/templates">_includes/templates</a> directory of the <a href="https://github.com/kubernetes/kubernetes.github.io">kubernetes.github.io</a> repository.
 | 
			
		||||
 | 
			
		||||
<h3 id="task_template">Task template</h3>
 | 
			
		||||
 | 
			
		||||
<p>A task page shows how to do a single thing, typically by giving a short
 | 
			
		||||
sequence of steps. Task pages have minimal explanation, but often provide links
 | 
			
		||||
to conceptual topics that provide related background and knowledge.</p>
 | 
			
		||||
 | 
			
		||||
<p>To write a new task page, create a Markdown file in a subdirectory of the
 | 
			
		||||
/docs/tasks directory. In your Markdown file, provide values for these
 | 
			
		||||
variables, and then include templates/task.md:</p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
    <li>overview - required</li>
 | 
			
		||||
    <li>prerequisites - required</li>
 | 
			
		||||
    <li>steps - required</li>
 | 
			
		||||
    <li>discussion - optional</li>
 | 
			
		||||
    <li>whatsnext - optional</li>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<p>Here's an example of a Markdown file that uses the task template:</p>
 | 
			
		||||
 | 
			
		||||
{% raw %}
 | 
			
		||||
<pre>---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
This page shows how to ...
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
* Do this.
 | 
			
		||||
* Do this too.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture steps %}
 | 
			
		||||
### Doing ...
 | 
			
		||||
 | 
			
		||||
1. Do this.
 | 
			
		||||
1. Do this next. Possibly read this [related explanation](...).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture discussion %}
 | 
			
		||||
### Understanding ...
 | 
			
		||||
 | 
			
		||||
Here's an interesting thing to know about the steps you just did.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
* Learn more about [this](...).
 | 
			
		||||
* See this [related task](...).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/task.md %}
 | 
			
		||||
</pre>
 | 
			
		||||
{% endraw %}
 | 
			
		||||
 | 
			
		||||
<p>Here's an example of a published topic that uses the task template:</p>
 | 
			
		||||
 | 
			
		||||
<p><a href="/docs/tasks/access-application-cluster/http-proxy-access-application-cluster">Using an HTTP Proxy to Access Applications in a Cluster</a></p>
 | 
			
		||||
 | 
			
		||||
<h3 id="tutorial_template">Tutorial template</h3>
 | 
			
		||||
 | 
			
		||||
<p>A tutorial page shows how to accomplish a goal that is larger than a single
 | 
			
		||||
task. Typically a tutorial page has several sections, each of which has a
 | 
			
		||||
sequence of steps. For example, a tutorial might provide a walkthrough of a
 | 
			
		||||
code sample that illustrates a certain feature of Kubernetes. Tutorials can
 | 
			
		||||
include surface-level explanations, but should link to related concept topics
 | 
			
		||||
for deep explanations.
 | 
			
		||||
 | 
			
		||||
<p>To write a new tutorial page, create a Markdown file in a subdirectory of the
 | 
			
		||||
/docs/tutorials directory. In your Markdown file, provide values for these
 | 
			
		||||
variables, and then include templates/tutorial.md:</p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
    <li>overview - required</li>
 | 
			
		||||
    <li>prerequisites - required</li>
 | 
			
		||||
    <li>objectives - required</li>
 | 
			
		||||
    <li>lessoncontent - required</li>
 | 
			
		||||
    <li>cleanup - optional</li>
 | 
			
		||||
    <li>whatsnext - optional</li>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<p>Here's an example of a Markdown file that uses the tutorial template:</p>
 | 
			
		||||
 | 
			
		||||
{% raw %}
 | 
			
		||||
<pre>---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
This page shows how to ...
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
* Do this.
 | 
			
		||||
* Do this too.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture objectives %}
 | 
			
		||||
* Learn this.
 | 
			
		||||
* Build this.
 | 
			
		||||
* Run this.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture lessoncontent %}
 | 
			
		||||
### Building ...
 | 
			
		||||
 | 
			
		||||
1. Do this.
 | 
			
		||||
1. Do this next. Possibly read this [related explanation](...).
 | 
			
		||||
 | 
			
		||||
### Running ...
 | 
			
		||||
 | 
			
		||||
1. Do this.
 | 
			
		||||
1. Do this next.
 | 
			
		||||
 | 
			
		||||
### Understanding the code
 | 
			
		||||
Here's something interesting about the code you ran in the preceding steps.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture cleanup %}
 | 
			
		||||
* Delete this.
 | 
			
		||||
* Stop this.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
* Learn more about [this](...).
 | 
			
		||||
* See this [related tutorial](...).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/tutorial.md %}
 | 
			
		||||
</pre>
 | 
			
		||||
{% endraw %}
 | 
			
		||||
 | 
			
		||||
<p>Here's an example of a published topic that uses the tutorial template:</p>
 | 
			
		||||
 | 
			
		||||
<p><a href="/docs/tutorials/stateless-application/run-stateless-application-deployment/">Running a Stateless Application Using a Deployment</a></p>
 | 
			
		||||
 | 
			
		||||
<h3 id="concept_template">Concept template</h3>
 | 
			
		||||
 | 
			
		||||
<p>A concept page explains some aspect of Kubernetes. For example, a concept
 | 
			
		||||
page might describe the Kubernetes Deployment object and explain the role it
 | 
			
		||||
plays as an application is deployed, scaled, and updated. Typically, concept
 | 
			
		||||
pages don't include sequences of steps, but instead provide links to tasks or
 | 
			
		||||
tutorials.
 | 
			
		||||
 | 
			
		||||
<p>To write a new concept page, create a Markdown file in a subdirectory of the
 | 
			
		||||
/docs/concepts directory. In your Markdown file,  provide values for these
 | 
			
		||||
variables, and then include templates/concept.md:</p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
    <li>overview - required</li>
 | 
			
		||||
    <li>body - required</li>
 | 
			
		||||
    <li>whatsnext - optional</li>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<p>Here's an example of a page that uses the concept template:</p>
 | 
			
		||||
 | 
			
		||||
{% raw %}
 | 
			
		||||
<pre>---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
This page explains ...
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture body %}
 | 
			
		||||
### Understanding ...
 | 
			
		||||
 | 
			
		||||
Kubernetes provides ...
 | 
			
		||||
 | 
			
		||||
### Using ...
 | 
			
		||||
 | 
			
		||||
To use ...
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
* Learn more about [this](...).
 | 
			
		||||
* See this [related task](...).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/concept.md %}
 | 
			
		||||
</pre>
 | 
			
		||||
{% endraw %}
 | 
			
		||||
 | 
			
		||||
<p>Here's an example of a published topic that uses the concept template:</p>
 | 
			
		||||
 | 
			
		||||
<p><a href="/docs/concepts/object-metadata/annotations">Annotations</a></p>
 | 
			
		||||
 | 
			
		||||
<!--</body>
 | 
			
		||||
</html>-->
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,133 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
 | 
			
		||||
This page shows how to create a Kubernetes Service object to that provides
 | 
			
		||||
load-balanced access to an application running in a cluster.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
 | 
			
		||||
* Install [kubectl](http://kubernetes.io/docs/user-guide/prereqs).
 | 
			
		||||
 | 
			
		||||
* Create a Kubernetes cluster, including a running Kubernetes
 | 
			
		||||
  API server. One way to create a new cluster is to use
 | 
			
		||||
  [Minikube](/docs/getting-started-guides/minikube).
 | 
			
		||||
 | 
			
		||||
* Configure `kubectl` to communicate with your Kubernetes API server. This
 | 
			
		||||
  configuration is done automatically if you use Minikube.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture objectives %}
 | 
			
		||||
 | 
			
		||||
* Run two instances of a Hello World application
 | 
			
		||||
* Create a Service object
 | 
			
		||||
* Use the Service object to access the running application
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture lessoncontent %}
 | 
			
		||||
 | 
			
		||||
### Creating a Service for an application running in two pods
 | 
			
		||||
 | 
			
		||||
1. Run a Hello World application in your cluster:
 | 
			
		||||
 | 
			
		||||
        kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0  --port=8080
 | 
			
		||||
 | 
			
		||||
1. List the pods that are running the Hello World application:
 | 
			
		||||
 | 
			
		||||
        kubectl get pods --selector="run=load-balancer-example"
 | 
			
		||||
 | 
			
		||||
    The output is similar to this:
 | 
			
		||||
 | 
			
		||||
        NAME                           READY     STATUS    RESTARTS   AGE
 | 
			
		||||
        hello-world-2189936611-8fyp0   1/1       Running   0          6m
 | 
			
		||||
        hello-world-2189936611-9isq8   1/1       Running   0          6m
 | 
			
		||||
 | 
			
		||||
1. List the replica set for the two Hello World pods:
 | 
			
		||||
 | 
			
		||||
        kubectl get replicasets --selector="run=load-balancer-example"
 | 
			
		||||
 | 
			
		||||
    The output is similar to this:
 | 
			
		||||
 | 
			
		||||
        NAME                     DESIRED   CURRENT   AGE
 | 
			
		||||
        hello-world-2189936611   2         2         12m
 | 
			
		||||
 | 
			
		||||
1. Create a Serivice object that exposes the replica set:
 | 
			
		||||
 | 
			
		||||
        kubectl expose rs <your-replica-set-name> --type="LoadBalancer" --name="example-service"
 | 
			
		||||
 | 
			
		||||
    where `<your-replica-set-name>` is the name of your replica set.
 | 
			
		||||
 | 
			
		||||
1. Display the IP addresses for your service:
 | 
			
		||||
 | 
			
		||||
        kubectl get services example-service
 | 
			
		||||
 | 
			
		||||
   The output shows the internal IP address and the external IP address of
 | 
			
		||||
   your service. If the external IP address shows as `<pending>`, repeat the
 | 
			
		||||
   command.
 | 
			
		||||
 | 
			
		||||
   Note: If you are using Minikube, you don't get an external IP address. The
 | 
			
		||||
   external IP address remains in the pending state.
 | 
			
		||||
 | 
			
		||||
       NAME              CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
 | 
			
		||||
       example-service   10.0.0.160   <pending>     8080/TCP   40s
 | 
			
		||||
 | 
			
		||||
1. Use your Service object to access the Hello World application:
 | 
			
		||||
 | 
			
		||||
        curl <your-external-ip-address>:8080
 | 
			
		||||
 | 
			
		||||
    where `<your-external-ip-address>` is the external IP address of your
 | 
			
		||||
    service.
 | 
			
		||||
 | 
			
		||||
    The output is a hello message from the application:
 | 
			
		||||
 | 
			
		||||
        Hello Kubernetes!
 | 
			
		||||
 | 
			
		||||
    Note: If you are using Minikube, enter these commands:
 | 
			
		||||
 | 
			
		||||
        kubectl cluster-info
 | 
			
		||||
        kubectl describe services example-service
 | 
			
		||||
 | 
			
		||||
    The output displays the IP address of your Minikube node and the NodePort
 | 
			
		||||
    value for your service. Then enter this command to access the Hello World
 | 
			
		||||
    application:
 | 
			
		||||
 | 
			
		||||
        curl <minikube-node-ip-address>:<service-node-port>
 | 
			
		||||
 | 
			
		||||
    where `<minikube-node-ip-address>` us the IP address of your Minikube node,
 | 
			
		||||
    and `<service-node-port>` is the NodePort value for your service.
 | 
			
		||||
 | 
			
		||||
### Using a service configuration file
 | 
			
		||||
 | 
			
		||||
As an alternative to using `kubectl expose`, you can use a
 | 
			
		||||
[service configuration file](/docs/user-guide/services/operations)
 | 
			
		||||
to create a Service.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture cleanup %}
 | 
			
		||||
 | 
			
		||||
If you want to stop the Hello World application, enter these commands:
 | 
			
		||||
 | 
			
		||||
    TODO
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
 | 
			
		||||
Learn more about
 | 
			
		||||
[connecting applications with services](/docs/user-guide/connecting-applications/).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/tutorial.md %}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,101 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
 | 
			
		||||
This page shows how to use `kubectl port-forward` to connect to a Redis
 | 
			
		||||
server running in a Kubernetes cluster. This type of connection can be useful
 | 
			
		||||
for database debugging.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
 | 
			
		||||
* Install [kubectl](http://kubernetes.io/docs/user-guide/prereqs).
 | 
			
		||||
 | 
			
		||||
* Create a Kubernetes cluster, including a running Kubernetes
 | 
			
		||||
  API server. One way to create a new cluster is to use
 | 
			
		||||
  [Minikube](/docs/getting-started-guides/minikube).
 | 
			
		||||
 | 
			
		||||
* Configure `kubectl` to communicate with your Kubernetes API server. This
 | 
			
		||||
  configuration is done automatically if you use Minikube.
 | 
			
		||||
 | 
			
		||||
* Install [redis-cli](http://redis.io/topics/rediscli).
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture steps %}
 | 
			
		||||
 | 
			
		||||
### Creating a pod to run a Redis server
 | 
			
		||||
 | 
			
		||||
1. Create a pod:
 | 
			
		||||
 | 
			
		||||
        export REPO=https://raw.githubusercontent.com/kubernetes/kubernetes.github.io/master
 | 
			
		||||
        kubectl create -f $REPO/docs/tasks/access-application-cluster/redis-master.yaml
 | 
			
		||||
 | 
			
		||||
    The output of a successful command verifies that the pod was created:
 | 
			
		||||
 | 
			
		||||
        pod "redis-master" created
 | 
			
		||||
 | 
			
		||||
1. Check to see whether the pod is running and ready:
 | 
			
		||||
 | 
			
		||||
        kubectl get pods
 | 
			
		||||
 | 
			
		||||
    When the pod is ready, the output displays a STATUS of Running:
 | 
			
		||||
 | 
			
		||||
        NAME           READY     STATUS    RESTARTS   AGE
 | 
			
		||||
        redis-master   2/2       Running   0          41s
 | 
			
		||||
 | 
			
		||||
1. Verify that the Redis server is running in the pod and listening on port 6379:
 | 
			
		||||
 | 
			
		||||
        {% raw %}
 | 
			
		||||
        kubectl get pods redis-master --template='{{(index (index .spec.containers 0).ports 0).containerPort}}{{"\n"}}'
 | 
			
		||||
        {% endraw %}
 | 
			
		||||
 | 
			
		||||
    The output displays the port:
 | 
			
		||||
 | 
			
		||||
        6379
 | 
			
		||||
 | 
			
		||||
### Forward a local port to a port on the pod
 | 
			
		||||
 | 
			
		||||
1. Forward port 6379 on the local workstation to port 6379 of redis-master pod:
 | 
			
		||||
 | 
			
		||||
        kubectl port-forward redis-master 6379:6379
 | 
			
		||||
 | 
			
		||||
    The output is similar to this:
 | 
			
		||||
 | 
			
		||||
        I0710 14:43:38.274550    3655 portforward.go:225] Forwarding from 127.0.0.1:6379 -> 6379
 | 
			
		||||
        I0710 14:43:38.274797    3655 portforward.go:225] Forwarding from [::1]:6379 -> 6379
 | 
			
		||||
 | 
			
		||||
1. Start the Redis command line interface:
 | 
			
		||||
 | 
			
		||||
        redis-cli
 | 
			
		||||
 | 
			
		||||
1. At the Redis command line prompt, enter the `ping` command:
 | 
			
		||||
 | 
			
		||||
        127.0.0.1:6379>ping
 | 
			
		||||
 | 
			
		||||
    A successful ping request returns PONG.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture discussion %}
 | 
			
		||||
 | 
			
		||||
### Discussion
 | 
			
		||||
 | 
			
		||||
Connections made to local port 6379 are forwarded to port 6379 of the pod that
 | 
			
		||||
is running the Redis server. With this connection in place you can use your
 | 
			
		||||
local workstation to debug the database that is running in the pod.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
Learn more about [kubectl port-forward](/docs/user-guide/kubectl/kubectl_port-forward/).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% include templates/task.md %}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
apiVersion: v1
 | 
			
		||||
kind: Pod
 | 
			
		||||
metadata:
 | 
			
		||||
  labels:
 | 
			
		||||
    name: redis
 | 
			
		||||
    redis-sentinel: "true"
 | 
			
		||||
    role: master
 | 
			
		||||
  name: redis-master
 | 
			
		||||
spec:
 | 
			
		||||
  containers:
 | 
			
		||||
    - name: master
 | 
			
		||||
      image: gcr.io/google_containers/redis:v1
 | 
			
		||||
      env:
 | 
			
		||||
        - name: MASTER
 | 
			
		||||
          value: "true"
 | 
			
		||||
      ports:
 | 
			
		||||
        - containerPort: 6379
 | 
			
		||||
      resources:
 | 
			
		||||
        limits:
 | 
			
		||||
          cpu: "0.1"
 | 
			
		||||
      volumeMounts:
 | 
			
		||||
        - mountPath: /redis-master-data
 | 
			
		||||
          name: data
 | 
			
		||||
    - name: sentinel
 | 
			
		||||
      image: kubernetes/redis:v1
 | 
			
		||||
      env:
 | 
			
		||||
        - name: SENTINEL
 | 
			
		||||
          value: "true"
 | 
			
		||||
      ports:
 | 
			
		||||
        - containerPort: 26379
 | 
			
		||||
  volumes:
 | 
			
		||||
    - name: data
 | 
			
		||||
      emptyDir: {}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,90 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
This page shows how to use an HTTP proxy to access the Kubernetes API.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
 | 
			
		||||
* Install [kubectl](http://kubernetes.io/docs/user-guide/prereqs).
 | 
			
		||||
 | 
			
		||||
* Create a Kubernetes cluster, including a running Kubernetes
 | 
			
		||||
  API server. One way to create a new cluster is to use
 | 
			
		||||
  [Minikube](/docs/getting-started-guides/minikube).
 | 
			
		||||
 | 
			
		||||
* Configure `kubectl` to communicate with your Kubernetes API server. This
 | 
			
		||||
  configuration is done automatically if you use Minikube.
 | 
			
		||||
 | 
			
		||||
* If you do not already have an application running in your cluster, start
 | 
			
		||||
  a Hello world application by entering this command:
 | 
			
		||||
 | 
			
		||||
        kubectl run --image=gcr.io/google-samples/node-hello:1.0 --port=8080
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture steps %}
 | 
			
		||||
 | 
			
		||||
### Using kubectl to start a proxy server
 | 
			
		||||
 | 
			
		||||
This command starts a proxy to the Kubernetes API server:
 | 
			
		||||
 | 
			
		||||
    kubectl proxy --port=8080
 | 
			
		||||
 | 
			
		||||
### Exploring the Kubernetes API
 | 
			
		||||
 | 
			
		||||
When the proxy server is running, you can explore the API using `curl`, `wget`,
 | 
			
		||||
or a browser.
 | 
			
		||||
 | 
			
		||||
Get the API versions:
 | 
			
		||||
 | 
			
		||||
    curl http://localhost:8080/api/
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
      "kind": "APIVersions",
 | 
			
		||||
      "versions": [
 | 
			
		||||
        "v1"
 | 
			
		||||
      ],
 | 
			
		||||
      "serverAddressByClientCIDRs": [
 | 
			
		||||
        {
 | 
			
		||||
          "clientCIDR": "0.0.0.0/0",
 | 
			
		||||
          "serverAddress": "10.0.2.15:8443"
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
Get a list of pods:
 | 
			
		||||
 | 
			
		||||
    curl http://localhost:8080/api/v1/namespaces/default/pods
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
      "kind": "PodList",
 | 
			
		||||
      "apiVersion": "v1",
 | 
			
		||||
      "metadata": {
 | 
			
		||||
        "selfLink": "/api/v1/namespaces/default/pods",
 | 
			
		||||
        "resourceVersion": "33074"
 | 
			
		||||
      },
 | 
			
		||||
      "items": [
 | 
			
		||||
        {
 | 
			
		||||
          "metadata": {
 | 
			
		||||
            "name": "kubernetes-bootcamp-2321272333-ix8pt",
 | 
			
		||||
            "generateName": "kubernetes-bootcamp-2321272333-",
 | 
			
		||||
            "namespace": "default",
 | 
			
		||||
            "selfLink": "/api/v1/namespaces/default/pods/kubernetes-bootcamp-2321272333-ix8pt",
 | 
			
		||||
            "uid": "ba21457c-6b1d-11e6-85f7-1ef9f1dab92b",
 | 
			
		||||
            "resourceVersion": "33003",
 | 
			
		||||
            "creationTimestamp": "2016-08-25T23:43:30Z",
 | 
			
		||||
            "labels": {
 | 
			
		||||
              "pod-template-hash": "2321272333",
 | 
			
		||||
              "run": "kubernetes-bootcamp"
 | 
			
		||||
            },
 | 
			
		||||
            ...
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
Learn more about [kubectl proxy](/docs/user-guide/kubectl/kubectl_proxy).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/task.md %}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,90 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
This page shows how to use an HTTP proxy to access the Kubernetes API.
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
 | 
			
		||||
* Install [kubectl](http://kubernetes.io/docs/user-guide/prereqs).
 | 
			
		||||
 | 
			
		||||
* Create a Kubernetes cluster, including a running Kubernetes
 | 
			
		||||
  API server. One way to create a new cluster is to use
 | 
			
		||||
  [Minikube](/docs/getting-started-guides/minikube).
 | 
			
		||||
 | 
			
		||||
* Configure `kubectl` to communicate with your Kubernetes API server. This
 | 
			
		||||
  configuration is done automatically if you use Minikube.
 | 
			
		||||
 | 
			
		||||
* If you do not already have an application running in your cluster, start
 | 
			
		||||
  a Hello world application by entering this command:
 | 
			
		||||
 | 
			
		||||
        kubectl run --image=gcr.io/google-samples/node-hello:1.0 --port=8080
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture steps %}
 | 
			
		||||
 | 
			
		||||
### Using kubectl to start a proxy server
 | 
			
		||||
 | 
			
		||||
This command starts a proxy to the Kubernetes API server:
 | 
			
		||||
 | 
			
		||||
    kubectl proxy --port=8080
 | 
			
		||||
 | 
			
		||||
### Exploring the Kubernetes API
 | 
			
		||||
 | 
			
		||||
When the proxy server is running, you can explore the API using `curl`, `wget`,
 | 
			
		||||
or a browser.
 | 
			
		||||
 | 
			
		||||
Get the API versions:
 | 
			
		||||
 | 
			
		||||
    curl http://localhost:8080/api/
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
      "kind": "APIVersions",
 | 
			
		||||
      "versions": [
 | 
			
		||||
        "v1"
 | 
			
		||||
      ],
 | 
			
		||||
      "serverAddressByClientCIDRs": [
 | 
			
		||||
        {
 | 
			
		||||
          "clientCIDR": "0.0.0.0/0",
 | 
			
		||||
          "serverAddress": "10.0.2.15:8443"
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
Get a list of pods:
 | 
			
		||||
 | 
			
		||||
    curl http://localhost:8080/api/v1/namespaces/default/pods
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
      "kind": "PodList",
 | 
			
		||||
      "apiVersion": "v1",
 | 
			
		||||
      "metadata": {
 | 
			
		||||
        "selfLink": "/api/v1/namespaces/default/pods",
 | 
			
		||||
        "resourceVersion": "33074"
 | 
			
		||||
      },
 | 
			
		||||
      "items": [
 | 
			
		||||
        {
 | 
			
		||||
          "metadata": {
 | 
			
		||||
            "name": "kubernetes-bootcamp-2321272333-ix8pt",
 | 
			
		||||
            "generateName": "kubernetes-bootcamp-2321272333-",
 | 
			
		||||
            "namespace": "default",
 | 
			
		||||
            "selfLink": "/api/v1/namespaces/default/pods/kubernetes-bootcamp-2321272333-ix8pt",
 | 
			
		||||
            "uid": "ba21457c-6b1d-11e6-85f7-1ef9f1dab92b",
 | 
			
		||||
            "resourceVersion": "33003",
 | 
			
		||||
            "creationTimestamp": "2016-08-25T23:43:30Z",
 | 
			
		||||
            "labels": {
 | 
			
		||||
              "pod-template-hash": "2321272333",
 | 
			
		||||
              "run": "kubernetes-bootcamp"
 | 
			
		||||
            },
 | 
			
		||||
            ...
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
Learn more about [kubectl proxy](/docs/user-guide/kubectl/kubectl_proxy).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/task.md %}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The Tasks section of the Kubernetes documentation is a work in progress
 | 
			
		||||
 | 
			
		||||
#### Accessing Applications in a Cluster
 | 
			
		||||
 | 
			
		||||
* [Using Port Forwarding to Access Applications in a Cluster](/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
 | 
			
		||||
 | 
			
		||||
#### Accessing the Kubernetes API
 | 
			
		||||
 | 
			
		||||
* [Using an HTTP Proxy to Access the Kubernetes API](/docs/tasks/access-kubernetes-api/http-proxy-access-api)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### What's next
 | 
			
		||||
 | 
			
		||||
If you would like to write a task page, see
 | 
			
		||||
[Using Page Templates](/docs/contribute/page-templates/)
 | 
			
		||||
for information about the task page type and the task template.
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
The Tutorials section of the Kubernetes documentation is a work in progress.
 | 
			
		||||
 | 
			
		||||
#### Stateless Applications
 | 
			
		||||
 | 
			
		||||
* [Running a Stateless Application Using a Deployment](/docs/tutorials/stateless-application/run-stateless-application-deployment/)
 | 
			
		||||
 | 
			
		||||
* [Exposing an External IP Address Using a Service](/docs/tutorials/stateless-application/expose-external-ip-address-service/)
 | 
			
		||||
 | 
			
		||||
### What's next
 | 
			
		||||
 | 
			
		||||
If you would like to write a tutorial, see
 | 
			
		||||
[Using Page Templates](/docs/contribute/page-templates/)
 | 
			
		||||
for information about the tutorial page type and the tutorial template.
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
apiVersion: extensions/v1beta1
 | 
			
		||||
kind: Deployment
 | 
			
		||||
metadata:
 | 
			
		||||
  name: nginx-deployment
 | 
			
		||||
spec:
 | 
			
		||||
  replicas: 2
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      labels:
 | 
			
		||||
        app: nginx
 | 
			
		||||
    spec:
 | 
			
		||||
      containers:
 | 
			
		||||
      - name: nginx
 | 
			
		||||
        image: nginx:1.8 # Update the version of nginx from 1.7.9 to 1.8
 | 
			
		||||
        ports:
 | 
			
		||||
        - containerPort: 80
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
apiVersion: extensions/v1beta1
 | 
			
		||||
kind: Deployment
 | 
			
		||||
metadata:
 | 
			
		||||
  name: nginx-deployment
 | 
			
		||||
spec:
 | 
			
		||||
  replicas: 2 # tells deployment to run 2 pods matching the template
 | 
			
		||||
  template: # create pods using pod definition in this template
 | 
			
		||||
    metadata:
 | 
			
		||||
      # unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is
 | 
			
		||||
      # generated from the deployment name
 | 
			
		||||
      labels:
 | 
			
		||||
        app: nginx
 | 
			
		||||
    spec:
 | 
			
		||||
      containers:
 | 
			
		||||
      - name: nginx
 | 
			
		||||
        image: nginx:1.7.9
 | 
			
		||||
        ports:
 | 
			
		||||
        - containerPort: 80
 | 
			
		||||
Contact GitHub API Training Shop Blog About
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,146 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
 | 
			
		||||
This page shows how to create a Kubernetes Service object that external
 | 
			
		||||
clients can use to access an application running in a cluster. The
 | 
			
		||||
Service exposes a stable IP address and provides load balancing for
 | 
			
		||||
an application that has two running instances.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
 | 
			
		||||
* Install [kubectl](http://kubernetes.io/docs/user-guide/prereqs).
 | 
			
		||||
 | 
			
		||||
* Create a Kubernetes cluster, including a running Kubernetes
 | 
			
		||||
  API server. One way to create a new cluster is to use
 | 
			
		||||
  [Minikube](/docs/getting-started-guides/minikube).
 | 
			
		||||
 | 
			
		||||
* Configure `kubectl` to communicate with your Kubernetes API server. This
 | 
			
		||||
  configuration is done automatically if you use Minikube.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture objectives %}
 | 
			
		||||
 | 
			
		||||
* Run two instances of a Hello World application.
 | 
			
		||||
* Create a Service object that exposes an external IP address.
 | 
			
		||||
* Use the Service object to access the running application.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture lessoncontent %}
 | 
			
		||||
 | 
			
		||||
### Creating a service for an application running in two pods
 | 
			
		||||
 | 
			
		||||
1. Run a Hello World application in your cluster:
 | 
			
		||||
 | 
			
		||||
        kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0  --port=8080
 | 
			
		||||
 | 
			
		||||
    The preceding command creates a
 | 
			
		||||
    [Deployment](/docs/user-guide/deployments/)
 | 
			
		||||
    object and an associated
 | 
			
		||||
    [ReplicaSet](/docs/user-guide/replicasets/)
 | 
			
		||||
    object. The ReplicaSet has two
 | 
			
		||||
    [Pods](/docs/user-guide/pods/),
 | 
			
		||||
    each of which runs the Hello World application.
 | 
			
		||||
 | 
			
		||||
1. Display information about the Deployment:
 | 
			
		||||
 | 
			
		||||
        kubectl get deployments hello-world
 | 
			
		||||
        kubectl describe deployments hello-world
 | 
			
		||||
 | 
			
		||||
1. Display information about the ReplicaSet:
 | 
			
		||||
 | 
			
		||||
        kubectl get replicasets hello-world
 | 
			
		||||
        kubectl describe replicasets hello-world
 | 
			
		||||
 | 
			
		||||
1. List the pods that are running the Hello World application:
 | 
			
		||||
 | 
			
		||||
        kubectl get pods --selector="run=load-balancer-example"
 | 
			
		||||
 | 
			
		||||
    The output is similar to this:
 | 
			
		||||
 | 
			
		||||
        NAME                           READY     STATUS    RESTARTS   AGE
 | 
			
		||||
        hello-world-2189936611-8fyp0   1/1       Running   0          6m
 | 
			
		||||
        hello-world-2189936611-9isq8   1/1       Running   0          6m
 | 
			
		||||
 | 
			
		||||
1. Create a Service object that exposes the deployment:
 | 
			
		||||
 | 
			
		||||
        kubectl expose deployment hello-world --type="LoadBalancer" --name="example-service"
 | 
			
		||||
 | 
			
		||||
1. Display the IP addresses for your service:
 | 
			
		||||
 | 
			
		||||
        kubectl get services example-service
 | 
			
		||||
 | 
			
		||||
   The output shows the internal IP address and the external IP address of
 | 
			
		||||
   your service. If the external IP address shows as `<pending>`, repeat the
 | 
			
		||||
   command.
 | 
			
		||||
 | 
			
		||||
   Note: If you are using Minikube, you don't get an external IP address. The
 | 
			
		||||
   external IP address remains in the pending state.
 | 
			
		||||
 | 
			
		||||
       NAME              CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
 | 
			
		||||
       example-service   10.0.0.160   <pending>     8080/TCP   40s
 | 
			
		||||
 | 
			
		||||
1. Use your service to access the Hello World application:
 | 
			
		||||
 | 
			
		||||
        curl <your-external-ip-address>:8080
 | 
			
		||||
 | 
			
		||||
    where `<your-external-ip-address>` is the external IP address of your
 | 
			
		||||
    service.
 | 
			
		||||
 | 
			
		||||
    The output is a hello message from the application:
 | 
			
		||||
 | 
			
		||||
        Hello Kubernetes!
 | 
			
		||||
 | 
			
		||||
    Note: If you are using Minikube, enter these commands:
 | 
			
		||||
 | 
			
		||||
        kubectl cluster-info
 | 
			
		||||
        kubectl describe services example-service
 | 
			
		||||
 | 
			
		||||
    The output displays the IP address of your Minikube node and the NodePort
 | 
			
		||||
    value for your service. Enter this command to access the Hello World
 | 
			
		||||
    application:
 | 
			
		||||
 | 
			
		||||
        curl <minikube-node-ip-address>:<service-node-port>
 | 
			
		||||
 | 
			
		||||
    where `<minikube-node-ip-address>` us the IP address of your Minikube node,
 | 
			
		||||
    and `<service-node-port>` is the NodePort value for your service.
 | 
			
		||||
 | 
			
		||||
### Using a service configuration file
 | 
			
		||||
 | 
			
		||||
As an alternative to using `kubectl expose`, you can use a
 | 
			
		||||
[service configuration file](/docs/user-guide/services/operations)
 | 
			
		||||
to create a Service.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture cleanup %}
 | 
			
		||||
 | 
			
		||||
To delete the Service, enter this command:
 | 
			
		||||
 | 
			
		||||
    kubectl delete services example-service
 | 
			
		||||
 | 
			
		||||
To delete the Deployment, the ReplicaSet, and the Pods that are running
 | 
			
		||||
the Hello World application, enter this command:
 | 
			
		||||
 | 
			
		||||
    kubectl delete deployment hello-world
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
 | 
			
		||||
Learn more about
 | 
			
		||||
[connecting applications with services](/docs/user-guide/connecting-applications/).
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/tutorial.md %}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,114 @@
 | 
			
		|||
---
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
{% capture overview %}
 | 
			
		||||
 | 
			
		||||
This page shows how to run an application using a Kubernetes Deployment object.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture objectives %}
 | 
			
		||||
 | 
			
		||||
* Create an nginx deployment.
 | 
			
		||||
* Use kubectl to list information about the deployment.
 | 
			
		||||
* Update the deployment.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture prerequisites %}
 | 
			
		||||
 | 
			
		||||
* To do this tutorial, you need a Kubernetes cluster, including a running
 | 
			
		||||
  Kubernetes API server. You can use an existing cluster, or you can create a
 | 
			
		||||
  new cluster. One way to create a new cluster is to use
 | 
			
		||||
  [Minikube](/docs/getting-started-guides/minikube).
 | 
			
		||||
 | 
			
		||||
* You also need to have `kubectl` installed on your local machine, and `kubectl`
 | 
			
		||||
  must be configured to communicate with your Kubernetes API server. This
 | 
			
		||||
  configuration is done automatically if you use Minikube.
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture lessoncontent %}
 | 
			
		||||
 | 
			
		||||
### Creating and exploring an nginx deployment
 | 
			
		||||
 | 
			
		||||
You can run an application by creating a Kubernetes Deployment object, and you
 | 
			
		||||
can describe a Deployment in a YAML file. For example, this YAML file describes
 | 
			
		||||
a Deployment that runs the nginx:1.7.9 Docker image:
 | 
			
		||||
 | 
			
		||||
{% include code.html language="yaml" file="deployment.yaml" ghlink="/docs/tutorials/stateless-application/deployment.yaml" %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1. Create a Deployment based on the YAML file:
 | 
			
		||||
 | 
			
		||||
        export REPO=https://raw.githubusercontent.com/kubernetes/kubernetes.github.io/master
 | 
			
		||||
        kubectl create -f $REPO/docs/tutorials/stateless-application/deployment.yaml
 | 
			
		||||
 | 
			
		||||
1. Display information about the Deployment:
 | 
			
		||||
 | 
			
		||||
        kubectl describe deployment nginx-deployment
 | 
			
		||||
 | 
			
		||||
        user@computer:~/kubernetes.github.io$ kubectl describe deployment nginx-deployment
 | 
			
		||||
        Name:     nginx-deployment
 | 
			
		||||
        Namespace:    default
 | 
			
		||||
        CreationTimestamp:  Tue, 30 Aug 2016 18:11:37 -0700
 | 
			
		||||
        Labels:     app=nginx
 | 
			
		||||
        Selector:   app=nginx
 | 
			
		||||
        Replicas:   2 updated | 2 total | 2 available | 0 unavailable
 | 
			
		||||
        StrategyType:   RollingUpdate
 | 
			
		||||
        MinReadySeconds:  0
 | 
			
		||||
        RollingUpdateStrategy:  1 max unavailable, 1 max surge
 | 
			
		||||
        OldReplicaSets:   <none>
 | 
			
		||||
        NewReplicaSet:    nginx-deployment-1771418926 (2/2 replicas created)
 | 
			
		||||
        No events.
 | 
			
		||||
 | 
			
		||||
1. List the pods created by the deployment:
 | 
			
		||||
 | 
			
		||||
        kubectl get pods -l app=nginx
 | 
			
		||||
 | 
			
		||||
        NAME                                READY     STATUS    RESTARTS   AGE
 | 
			
		||||
        nginx-deployment-1771418926-7o5ns   1/1       Running   0          16h
 | 
			
		||||
        nginx-deployment-1771418926-r18az   1/1       Running   0          16h
 | 
			
		||||
 | 
			
		||||
1. Display information about a pod:
 | 
			
		||||
 | 
			
		||||
        kubectl display pod <pod-name>
 | 
			
		||||
 | 
			
		||||
    where `<pod-name>` is the name of one of your pods.
 | 
			
		||||
 | 
			
		||||
### Updating the deployment
 | 
			
		||||
 | 
			
		||||
You can update the deployment by applying a new YAML file. This YAML file
 | 
			
		||||
specifies that the deployment should be updated to use nginx 1.8.
 | 
			
		||||
 | 
			
		||||
{% include code.html language="yaml" file="deployment-update.yaml" ghlink="/docs/tutorials/stateless-application/deployment-update.yaml" %}
 | 
			
		||||
 | 
			
		||||
1. Apply the new YAML file:
 | 
			
		||||
 | 
			
		||||
        kubectl apply -f $REPO/docs/tutorials/stateless-application/deployment-update.yaml
 | 
			
		||||
 | 
			
		||||
1. Watch the deployment create pods with new names and delete the old pods:
 | 
			
		||||
 | 
			
		||||
        kubectl get pods -l app=nginx
 | 
			
		||||
 | 
			
		||||
### Deleting a deployment
 | 
			
		||||
 | 
			
		||||
Delete the deployment by name:
 | 
			
		||||
 | 
			
		||||
    kubectl delete deployment nginx-deployment
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% capture whatsnext %}
 | 
			
		||||
 | 
			
		||||
* Learn more about [Deployment objects](/docs/user-guide/deployments/).
 | 
			
		||||
 | 
			
		||||
* Learn more about [Deploying applications](/docs/user-guide/deploying-applications/)
 | 
			
		||||
 | 
			
		||||
{% endcapture %}
 | 
			
		||||
 | 
			
		||||
{% include templates/tutorial.md %}
 | 
			
		||||
		Loading…
	
		Reference in New Issue