帮助中心

疑难问题解答,常见问题和社区帮助渠道。

编辑这个页面

贡献 Kubernetes 文档

 

继续编辑

点击下面的链接来编辑刚才的页面。编辑完成以后,点击屏幕下方的"Commit Changes"。它会在你的 Github 上创建一个 "fork"。创建完成以后,你还可以在你的"fork"上修改其他页面。如果你要把修改后的页面发送给我们,你只需要到你的“fork”页面,然后点击"New Pull Request"。

在云端编辑我们的网站

点击下面的按钮来访问我们网站的代码库,然后你可以点击右上角的“Fork”按钮,来复制我们的网站到你的 Github 上一个“fork”。你可以在你的的“fork”上修改一些页面,修改完毕以后,你可以在“fork”的主页点击 "New Pull Request" 来吧你的修改发送给我们。

浏览网站源代码

Instructions for Contributing to the Docs/Website

Welcome! We are very pleased you want to contribute to the documentation and/or website for Kubernetes.

You can click the “Fork” button in the upper-right area of the screen to create a copy of our site on your GitHub account called a “fork.” Make any changes you want in your fork, and when you are ready to send those changes to us, go to the index page for your fork and click “New Pull Request” to let us know about it.

Staging the site on GitHub Pages

If you want to see your changes staged without having to install anything locally, remove the CNAME file in this directory and change the name of the fork to be:

YOUR_GITHUB_USERNAME.github.io

Then make your changes.

When you visit http://YOUR_GITHUB_USERNAME.github.io you should see a special-to-you version of the site that contains the changes you just made.

Staging the site locally (using Docker)

Don’t like installing stuff? Download and run a local staging server with a single docker run command.

git clone https://github.com/kubernetes/kubernetes.github.io.git
cd kubernetes.github.io
docker run -ti --rm -v "$PWD":/k8sdocs -p 4000:4000 johndmulhausen/k8sdocs

Then visit http://localhost:4000 to see our site. Any changes you make on your local machine will be automatically staged.

If you’re interested you can view the Dockerfile for this image.

Staging the site locally (from scratch setup)

The below commands to setup your environment for running GitHub pages locally. Then, any edits you make will be viewable on a lightweight webserver that runs on your local machine.

This will typically be the fastest way (by far) to iterate on docs changes and see them staged, once you get this set up, but it does involve several install steps that take awhile to complete, and makes system-wide modifications.

Install Ruby 2.2 or higher. If you’re on Linux, run these commands:

apt-get install software-properties-common
apt-add-repository ppa:brightbox/ruby-ng
apt-get install ruby2.2
apt-get install ruby2.2-dev

The remainder of the steps should work the same across operating systems.

To confirm you’ve installed Ruby correctly, at the command prompt run gem --version and you should get a response with your version number. Likewise you can confirm you have Git installed properly by running git --version, which will respond with your version of Git.

Install the GitHub Pages package, which includes Jekyll:

gem install github-pages

Clone our site:

git clone https://github.com/kubernetes/kubernetes.github.io.git

Make any changes you want. Then, to see your changes locally:

cd kubernetes.github.io
jekyll serve

Your copy of the site will then be viewable at: http://localhost:4000 (or wherever Jekyll tells you).

GitHub help

If you’re a bit rusty with git/GitHub, you might wanna read this for a refresher.

Common Tasks

Edit Page Titles or Change the Left Navigation

Edit the yaml files in /_data/ for the Guides, Reference, Samples, or Support areas.

You may have to exit and jekyll clean before restarting the jekyll serve to get changes to files in /_data/ to show up.

Add Images

Put the new image in /images/docs/ if it’s for the documentation, and just /images/ if it’s for the website.

For diagrams, we greatly prefer SVG files!

Include code from another file

To include a file that is hosted on this GitHub repo, insert this code:

{% include code.html language="<LEXERVALUE>" file="<RELATIVEPATH>" ghlink="<PATHFROMROOT>" %}

To include a file that is hosted in the external, main Kubernetes repo, make sure it’s added to /update-imported-docs.sh, and run it so that the file gets downloaded, then enter:

{% include code.html language="<LEXERVALUE>" file="<RELATIVEPATH>" k8slink="<PATHFROMK8SROOT>" %}

Using tabs for multi-language examples

By specifying some inline CSV in a varable called tabspec, you can include a file called tabs.html that generates tabs showing code examples in multiple langauges.

{% capture tabspec %}servicesample
JSON,json,service-sample.json,/docs/user-guide/services/service-sample.json
YAML,yaml,service-sample.yaml,/docs/user-guide/services/service-sample.yaml{% endcapture %}
{% include tabs.html %}

In English, this would read: “Create a set of tabs with the alias servicesample, and have tabs visually labeled “JSON” and “YAML” that use json and yaml Rouge syntax highlighting, which display the contents of service-sample.{extension} on the page, and link to the file in GitHub at (full path).”

Example file: Pods: Multi-Container.

Use a global variable

The /_config.yml file defines some useful variables you can use when editing docs.

This keeps the docs you’re editing aligned with the Kubernetes version you’re talking about. For example, if you define a link like so, you’ll never have to worry about it going stale in future doc branches:

View the README [here](http://releases.k8s.io/{{page.githubbranch}}/cluster/addons/README.md).

That, of course, will send users to:

http://releases.k8s.io/release-1.2/cluster/addons/README.md

(Or whatever Kubernetes release that docs branch is associated with.)

Branch structure

The current version of the website is served out of the master branch.

All versions of the site that relate to past and future versions will be named after their Kubernetes release number. For example, the old branch for the 1.1 docs is called release-1.1.

Changes in the “docsv2” branch (where we are testing a revamp of the docs) are automatically staged here: http://k8sdocs.github.io/docs/tutorials/

Changes in the “release-1.1” branch (for k8s v1.1 docs) are automatically staged here: http://kubernetes-v1-1.github.io/

Changes in the “release-1.3” branch (for k8s v1.3 docs) are automatically staged here: http://kubernetes-v1-3.github.io/

Editing of these branches will kick off a build using Travis CI that auto-updates these URLs; you can monitor the build progress at https://travis-ci.org/kubernetes/kubernetes.github.io.

Partners

Kubernetes partners refers to the companies who contribute to the Kubernetes core codebase and/or extend their platform to support Kubernetes. Partners can get their logos added to the partner section of the community page by following the below steps and meeting the below logo specifications. Partners will also need to have a URL that is specific to integrating with Kubernetes ready; this URL will be the destination when the logo is clicked.

Thank you!

Kubernetes thrives on community participation and we really appreciate your contributions to our site and our documentation!

Analytics