求知 文章 文库 Lib 视频 iPerson 课程 认证 咨询 工具 讲座 Model Center   Code  
会员   
要资料
 
 
 

Kubernetes教程
Kubernetes概述
Kubernetes设计架构
kubernetes设计理念
创建Kubernetes集群
基于Docker本地运行Kubernetes
使用Vagrant
本地运行Kubrenetes v1.0
Google Computer Engine入门
AWS EC2快速入门
在Azure上使用CoreOS和Weave的 Kubernetes
从零开始k8s
CoreOS部署Kubernetes集群
CloudStack部署Kubernetes集群
vSphere部署Kubernetes集群
Ferdora部署Kubernetes集群
CentOS部署Kubernetes集群
Ubuntu物理节点上部署Kubernets集群
Mesos部署Kubernetes集群
Kubernetes用户指南:应用程序管理
名词解释 Pods
名词解释 Labels
名词解释:Namespace
名词解释 Replication Controller
名词解释:Node
名词解释:ReplicaSets
名词解释 Services
名词解释 Volumes
名词解释:PV/PVC/StorageClass
名称解释:Deployment
名词解释:Secret
名词解释:StatefulSet
名词解释:DaemonSet
名词解释:Service Account
名词解释:CronJob
名词解释:Job
名词解释:Security Context和PSP
名词解释:Resource Quotas
名词解释:Network Policy
名词解释:Ingress
名词解释:ThirdPartyResources
名词解释:ConfigMap
名词解释:PodPreset
配置Kubernetes
管理应用:部署持续运行的应用
Horizontal Pod Autoscaling
管理应用:连接应用
管理应用: 在生产环境中使用Pods和容器
Kubernetes UI
Kube-API Server
授权插件
认证插件
API Server端口配置
Admission Controller
Service Accounts集群管理指南
使用Kubernetes在云上原生部署cassandra
Spark例子
Storm 示例
示例: 分布式任务队列 Celery, RabbitMQ和Flower
Kubernetes在Hazelcast平台上部署原生云应用
Meteor on Kuberenetes
配置文件使用入门
环境向导示例
在Kubernetes上运行你的第一个容器
kubectl
安装和设置kubectl
kubectl annotate
kubectl api-versions
kubectl apply
kubectl attach
kubectl cluster-info
kubectl config
kubectl config set-cluster
kubectl config set-context
kubectl config set-credentials
kubectl config set
kubectl config unset
kubectl config use-context
kubectl config view
kubectl create
kubectl delete
kubectl describe
kubectl edit
kubectl exec
kubectl logs
kubectl version
故障排查
应用程序相关的故障排查
 
 

在Kubernetes上运行你的第一个容器
 
1126 次浏览
62次  

好了,如果你已经开始了任何一个入门指南,并且启动了一个Kubernetes集群。那么接下来呢? 这个指南会帮助你正对Kubernetes,在其集群上运行第一个容器。

运行一个容器 (简单版)

从这时开始,我假设你已经根据其它入门指南安装了kubectl。

下面这行kubectl命令会穿件两个监听80端口的nginx pod. 还会创建一个为my-nginx个replication controller,用来保证始终会有两个pod在运行。

kubectl run my-nginx --image=nginx --replicas=2 --port=80

一旦这些pod被创建好了, 你可以列出他们并查看他们的启动和运行。

kubectl get pods

你也能够看见replication controller被创建了:

kubectl get rc

To stop the two replicated containers, stop the replication controller: 如果要停止这两个被复制的容器,你可以通过停止replication: controller

kubectl stop rc my-nginx

让你的的pod可以被外网方位.

在一些平台上(例如Google Compute Engine),kubectl命令能够集成云端提供的API来给pod条件公有IP地址,可以通过以下命令来实现:

kubectl expose rc my-nginx --port=80 --type=LoadBalancer

这个命令会打印出被创建了的service,以及一个外部IP地址映射到service. 对外的IP地址根你实际运行环境有关。例如,对于Google Compute Engine的外部IP地址会被列为新创建的服务的一部分,还可以通在运行时检索。

kubectl get services

为了访问你的nginx初始页面,你还不得不保证通过外部IP的通信是被允许的。那么就要通过让防火墙允许80端口通信才可以做到

接下来: 配置文件

Most people will eventually want to use declarative configuration files for creating/modifying their applications. A simplified introduction is given in a different document.

大多数人最终都希望使用声明性配置文件来创建/修改其应用程序。 另外一个文档给出了一个简单介绍。


您可以捐助,支持我们的公益事业。

1元 10元 50元





认证码: 验证码,看不清楚?请点击刷新验证码 必填



1126 次浏览
62次
 捐助