Kubernetes manifests工具-Kompose

一、Kompose

Kompose是一个将docker-compose配置转换成Kubernetes manifests的工具,官方网站
为http://kompose.io/。

二、Kompose安装

1. # Linux
2.
$ curl -L https://github.com/kubernetes-incubator/kompose/releases/download/v0.5.0
linux-amd64 -o kompose
3.
4. # macOS
5.
$ curl -L https://github.com/kubernetes-incubator/kompose/releases/download/v0.5.0
darwin-amd64 -o kompose
6.
7. # Windows
8.
$ curl -L https://github.com/kubernetes-incubator/kompose/releases/download/v0.5.0
windows-amd64.exe -o kompose.exe
9.
10. # 放到PATH中
11. $ chmod +x kompose
12. $ sudo mv ./kompose /usr/local/bin/kompose

三、Kompose使用

1.docker-compose.yaml

1. version: "2"
2.
3. services:
4.
5. redis-master:
6. image: gcr.io/google_containers/redis:e2e
7. ports:
8. - "6379"
9.
10. redis-slave:
11. image: gcr.io/google_samples/gb-redisslave:v1
12. ports:
13. - "6379"
14. environment:
15. - GET_HOSTS_FROM=dns
16.
17. frontend:
18. image: gcr.io/google-samples/gb-frontend:v4
19. ports:
20. - "80:80"
21. environment:
22. - GET_HOSTS_FROM=dns
23. labels:
24. kompose.service.type: LoadBalancer

2.kompose up

1. $ kompose up
2.
We are going to create Kubernetes Deployments, Services and
PersistentVolumeClaims for your Dockerized application.
3.
If you need different kind of resources, use the 'kompose convert' and 'kubectl
create -f' commands instead.
4.
5. INFO Successfully created Service: redis
6. INFO Successfully created Service: web
7. INFO Successfully created Deployment: redis
8. INFO Successfully created Deployment: web
9.
10.
Your application has been deployed to Kubernetes. You can run 'kubectl get
deployment,svc,pods,pvc' for details.

3.kompose convert

1. $ kompose convert
2. INFO file "frontend-service.yaml" created
3. INFO file "redis-master-service.yaml" created
4. INFO file "redis-slave-service.yaml" created
5. INFO file "frontend-deployment.yaml" created
6. INFO file "redis-master-deployment.yaml" created
7. INFO file "redis-slave-deployment.yaml" created
  • 12
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值