k8s笔记之chartmuseum搭建

一、下载安装包

#在master节点中执行,以下这条命令就是下载文件到当前目录而已,下载完成之后让我们将chartmuseum赋予权限,就是可执行了chmod 777 chartmuseum,然后移动到/usr/local/bin。
[root@k8s-master-155-221 ~]# curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/linux/amd64/chartmuseum
[root@k8s-master-155-221 ~]# chmod 777 chartmuseum 
[root@k8s-master-155-221 ~]# mv chartmuseum /usr/local/bin

二、创建服务配置和启动文件

服务启动文件

[root@k8s-master-155-221 ~]# vim /etc/systemd/system/chartmuseum.service
[Unit]
Description=chartmuseum
Requires=network-online.target
After=network-online.target

[Service]
EnvironmentFile=/etc/chartmuseum/chartmuseum.config
User=root
Restart=allways
ExecStart=/usr/local/bin/chartmuseum $ARGS
ExecStop=/usr/local/bin/chartmuseum step-down

[Install]
WantedBy=multi-user.target

服务配置文件

[root@k8s-master-155-221 ~]# mkdir /etc/chartmuseum/
[root@k8s-master-155-221 ~]# vim /etc/chartmuseum/chartmuseum.config 
ARGS=\
--port=8080 \   #服务提供的端口
--storage="local" \   #存储类型 这里使用本地
--storage-local-rootdir="/var/lib/chartmuseum/chartstorage" \   #本地存储chart的路径
--log-json \       
--basic-auth-user=admin \  #登录的账号秘密
--basic-auth-pass="123456"

启动服务

[root@k8s-master-155-221 ~]# systemctl start chartmuseum
[root@k8s-master-155-221 ~]# systemctl status chartmuseum

三、配置helm使用chartmuseum

1.安装helm-push插件,指定helm-push路径

如果使用helm进行推送需要在本地安装一个插件,仓库:https://github.com/Coding/helm-push, 执行以下命令安装插件
[root@k8s-master-155-221 ~]# helm plugin install https://github.com/chartmuseum/helm-push

2.添加chartmuseum仓库 注意防火墙开放端口

[root@k8s-master-155-221 ~]# helm repo add chartmuseum http://172.16.155.221:8080 --username admin --password 123456
"chartmuseum" has been added to your repositories

3.测试是否可以上传

[root@k8s-master-155-221 ~]# helm search redis
[root@k8s-master-155-221 ~]# helm install stable/redis
[root@k8s-master-155-221 ~]# ll .helm/cache/archive/
-rw-r--r-- 1 root root 6189 2019-12-13 13:55 redis-1.1.15.tgz
[root@k8s-master-155-221 ~]# helm push redis-1.1.15.tgz  chartmuseum 
Pushing redis-1.1.15.tgz to chartmuseum...
Done.

4.查看仓库信息

[root@k8s-master-155-221 ~]# curl -u admin:123456 http://172.16.155.221:8080/api/charts
{"demo":[{"name":"demo","version":"0.1.0","description":"A Helm chart for Kubernetes","apiVersion":"v1","appVersion":"1.0","urls":["charts/demo-0.1.0.tgz"],"created":"2019-12-13T15:07:40.27781012+08:00","digest":"38658e69ea5b461904eaf946ea2b82debd3a07eb55226dd6fcfeb74f1fe6088e"}]}
posted @ 2019-12-13 15:11  百衲本  阅读(1858)  评论(0编辑  收藏  举报
cnblogs_post_body { color: black; font: 0.875em/1.5em "微软雅黑" , "PTSans" , "Arial" ,sans-serif; font-size: 15px; } cnblogs_post_body h1 { text-align:center; background: #333366; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 23px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } cnblogs_post_body h2 { text-align:center; background: #006699; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 20px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } cnblogs_post_body h3 { background: #2B6695; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 18px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } 回到顶部 博客侧边栏 回到顶部 页首代码 回到顶部 页脚代码