【发布时间】:2016-04-14 13:07:29
【问题描述】:
首先我下载了 kubernetes、kubectl 并从 aws 创建了一个集群 (export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | bash
)
我在我的项目 circle.yml 中添加了一些行,以使用 circleCI 服务来构建我的图像。
为了支持 docker 我添加了:
machine:
services:
- docker
并创建我的图像并将其发送到我添加的工件:
deployment:
commands:
- docker login -e admin@comp.com -u ${ARTUSER} -p ${ARTKEY} docker-docker-local.someartifactory.com
- sbt -DBUILD_NUMBER="${CIRCLE_BUILD_NUM}" docker:publish
之后我创建了 2 个文件夹:
我的项目(MyApp)文件夹有两个文件:
controller.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: MyApp
labels:
name: MyApp
spec:
replicas: 1
selector:
name: MyApp
template:
metadata:
labels:
name: MyApp
version: 0.1.4
spec:
containers:
- name: MyApp
#this is the image artifactory
image: docker-docker-release.someartifactory.com/MyApp:0.1.4
ports:
- containerPort: 9000
imagePullSecrets:
- name: myCompany-artifactory
service.yaml
apiVersion: v1
kind: Service
metadata:
name: MyApp
labels:
name: MyApp
spec:
# if your cluster supports it, uncomment the following to automatically create
# an external load-balanced IP for the frontend service.
type: LoadBalancer
ports:
# the port that this service should serve on
- port: 9000
selector:
name: MyApp
我的工件还有另一个文件夹(种类:秘密)。
现在我创建了我的 pod:
kubectl create -f controller.yaml
现在,当我签入 kubectl get pods 时,我的 pod 正在运行。
现在,如何从浏览器访问我的 pod?我的项目是一个 play 项目,所以我想从浏览器中访问它...如何以最简单的方式公开它?
谢谢
【问题讨论】:
标签: amazon-web-services docker cluster-computing kubernetes