

使用kompose把docker-compose文件转换成k8s资源
source link: https://www.bboy.app/2022/05/09/%E4%BD%BF%E7%94%A8kompose%E6%8A%8Adocker-compose%E6%96%87%E4%BB%B6%E8%BD%AC%E6%8D%A2%E6%88%90k8s%E8%B5%84%E6%BA%90/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用kompose把docker-compose文件转换成k8s资源
Have a nice try
安装很简单,直接一个二进制下载过来就好了
wget https://github.com/kubernetes/kompose/releases/download/v1.26.1/kompose-linux-amd64.tar.gz
tar -zxvf kompose-linux-amd64.tar.gz
mv kompose-linux-amd64 /bin/kompose
首先准备一个docker-compose文件
version: "3"
services:
prometheus:
image: "prom/prometheus:v2.35.0"
volumes:
- "./prometheus-conf/prometheus.yml:/etc/prometheus/prometheus.yml"
- "./data:/prometheus"
- "/etc/localtime:/etc/localtime"
- "./prometheus-conf/file_sd:/file_sd"
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--web.enable-lifecycle"
- "--web.enable-admin-api"
- "--web.enable-remote-write-receiver"
- "--storage.tsdb.retention.time=7d"
- "--storage.tsdb.max-block-duration=2h"
- "--storage.tsdb.min-block-duration=2h"
ports:
- "9000:9000"
- "9090:9090"
restart: "always"
container_name: "prometheus"
之后直接执行
kompose convert
如果你的文件不是docker-compose.yaml
这个名字的,你可以使用-f
参数取指定文件名字
这样生成出来的资源文件默认会带上
annotations:
kompose.cmd: kompose convert
kompose.version: 1.26.1 (a9d05d509)
这两个annotations
如果你不想要的话可以这么做
./kompose-linux-amd64 convert -f docker-compose.yaml --with-kompose-annotation=false
默认kompose转换出来的是deployment,当然你想转成daemonset,你可以使用下面参数
--controller=daemonSet
如果你不想生成文件,可以使用下面参数直接输出到屏幕中
--stdout
转换出来的质量还可以,可以帮助yaml工程师少写几个参数了
欢迎关注我的博客www.bboy.app
Have Fun
Recommend
-
13
在 Linux 中把多个 Markdown 文件转换成 HTML 或其他格式 | Linux 中国我用 pandoc 来转换文件,它可以一次性地转换所有 Markdown 文件。来源:
-
10
Kompose (Kubernetes + Compose) kompose is a tool to help users who are familiar with docker-compose move to Kubernetes. kompose takes a Docker Compose file an...
-
9
KaMP Kit and Jetpack Compose Hey folks, Brady from Touchlab here. I've only been at Touchlab since the beginning of the year, but KaMP Kit, our simple-but-not-too-simple sampl...
-
12
MOV 视频很大, 每次教娃视频如果是在 4k 60fps 下 十来分钟就得1个多G. 我手机上拍完之后用 Dropbox 同步到电脑上, 很快硬盘空间就不太够了. 我们可...
-
5
V2EX › Java jar 文件怎么转换成 exe 文件 woshichuanqilz · 22 小时 30 分钟前 · 2035...
-
7
ofd格式文件转换成pdf格式的方法 原创 迷失蒲公英 2022-08-11 22:19:29
-
8
将AWS Router53 DNS 导出文件转换成兼容 BIND的区域文件并导入到Azure DNS 原创 在...
-
3
【笔记】Mac批量将Word文件转换成PDF文件 2022-08-23 1...
-
6
怎么把微信语音转换成音频文件 微信推广 发布...
-
7
很多朋友都不会将psd文件转化成cdr文件,因此对于这个文件基本上都是束手无策也不知道该怎么去进行操作,其实可以直接导入,然后右击重新保存改格式就好了。 psd文件怎么转换成cdr格式: 1、首先打开cdr软件进入主界面。 ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK