k8s--helm

什么是helm?在没有这个helm之前,deployment service ingress

helm的作用

通过打包的方式,把deployment service ingress等打包在一块,一键式的部署服务,类似yum安装

官方提供的一个类似与安装仓库额功能,可以实现一键化部署应用

helm的概念

三个部分组成

1、chartL helm的软件包,部署包,service ingress,定义好的yaml资源,类似于yum的rpm包

2、Release 可以理解为版本,也可以理解为在安装过程中,给这个部署的应用起一个名字

3、Repository 仓库,提供一个服务器,这个服务器中包含chartL的资源,yaml的资源保存的地址

版本

helm3 命令行

helm3 纯命令行方式

把源码包拖到helm
helm-v3.12.0-linux-amd64.tar.gz
解压
tar -xf helm-v3.12.0-linux-amd64.tar.gz
进入linux-amd64/
cd  linux-amd64/把helm拖到usr/local/bin下
mv helm  /usr/local/bin/helm添加自动补全
vim /etc/profilesource <(helm completion bash)
立刻生效
source /etc/profile搜索资源helm search repo aliyun | grep nginx查看chart的详细信息
helm show chart bitnami/nginx(一般)
helm show all bitnami/nginx(所有)安装
helm install my-nginx bitnami/nginx 
helm install	安装
my-nginx	安装的名称或者版本
bitnami/nginx  bitnami仓库名,nginx就是chart一系列yaml资源的集合删除
helm uninstall my-nginxhelm install bitnami/nginx --generate-name
--generate-name	随机指定Release名称helm ls	查看所有安装Release
helm自定义模版

根据自己的需求,自定义chart,然后部署到集群当中

拉取包(mysql)
helm pull stable/mysql解压
tar -xf mysql-1.6.9.tgz创建nginx
helm create nginx查看创建的nginx的目录
tree nginx
nginx/
├── charts
├── Chart.yaml
├── templates
│   ├── deployment.yaml
│   ├── _helpers.tpl
│   ├── hpa.yaml
│   ├── ingress.yaml
│   ├── NOTES.txt
│   ├── serviceaccount.yaml
│   ├── service.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yamlcharts	用于存储依赖,如果这个chart依赖于其他的chart,依赖文件保存在这个目录
Chart.yaml	helm chart的元数据文件,包含了这个chart的名称,版本,维护者信息等等
Template	包含清单模版目录
deployment.yaml	部署应用的模版文件
helpers.tpl	帮助文档,告诉用户如何来定义模版的值
hpa.yaml	定义了应用程序副本数的扩缩容行为
ingress.yaml	定义了外部流量如何转发到应用程序
NOTES.txt	注意事项
serviceaccount.yaml	应用程序的服务账号
service.yaml	集群内部的访问
tests test-connection.yaml	测试的目录和文件,部署完chart之后,用来测试的文件
values.yaml	核心文件,自定义的值,都是通过values.yaml,把我们数据覆盖到安装的chart修改values.yaml# Default values for nginx.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.replicaCount: 3
#创建的副本数image:repository: nginxpullPolicy: IfNotPresent# Overrides the image tag whose default is the chart appVersion.tag: "1.22"
#指向镜像的版本imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""serviceAccount:# Specifies whether a service account should be createdcreate: true# Annotations to add to the service accountannotations: {}# The name of the service account to use.# If not set and create is true, a name is generated using the fullname templatename: ""podAnnotations: {}podSecurityContext: {}# fsGroup: 2000securityContext: {}# capabilities:#   drop:#   - ALL# readOnlyRootFilesystem: true# runAsNonRoot: true# runAsUser: 1000service:type: ClusterIPport: 80ingress:enabled: trueclassName: ""annotations: {}# kubernetes.io/ingress.class: nginx# kubernetes.io/tls-acme: "true"hosts:- host: www.lucky-cloud.yamlpaths:- path: /pathType: Prefixtls: []#  - secretName: chart-example-tls#    hosts:#      - chart-example.localresources:# We usually recommend not to specify default resources and to leave this as a conscious# choice for the user. This also increases chances charts run on environments with little# resources, such as Minikube. If you do want to specify resources, uncomment the following# lines, adjust them as necessary, and remove the curly braces after 'resources:'.limits:cpu: "1"memory: 512Mi
autoscaling:enabled: falseminReplicas: 1maxReplicas: 100targetCPUUtilizationPercentage: 80# targetMemoryUtilizationPercentage: 80nodeSelector: {}tolerations: []affinity: {}验证语法
[root@master01 linux-amd64]# helm lint nginx
==> Linting nginx
[INFO] Chart.yaml: icon is recommended1 chart(s) linted, 0 chart(s) failed打包
helm package nginx
Successfully packaged chart and saved it to: /opt/helm/linux-amd64/nginx-0.1.0.tgz部署
helm install nginx-11 ./nginx --dry-run  --debug
helm install	安装chart
nginx-11	 Release版本号
./nginx		当前目录下的nginx的chart
--dry-run --debug	这个chart不会被部署到集群当中,参数验证,测试chart的配置是否正确安装
方法一
helm install nginx-11 ./nginx -n default
方法二
helm install nginx-11 /opt/helm/linux-amd64/nginx-0.1.0.tgz -n default
删除
helm uninstall nginx-11
修改chart之后重新部署
修改values.yaml
.......
service:type: NodePortport: 80nodePort: 31000
ingress:enabled: falseclassName: ""annotations: {}
......修改service.yaml
apiVersion: v1
kind: Service
metadata:name: {{ include "nginx.fullname" . }}labels:{{- include "nginx.labels" . | nindent 4 }}
spec:type: {{ .Values.service.type }}ports:- port: {{ .Values.service.port }}targetPort: httpprotocol: TCPname: httpnodePort: {{.Values.service.nodePort}}selector:{{- include "nginx.selectorLabels" . | nindent 4 }}检测
helm lint nginx更新
helm upgrade nginx-11 nginx
回滚
查看回滚
helm history nginx-11
REVISION	UPDATED                 	STATUS    	CHART      	APP VERSION	DESCRIPTION     
1       	Sun Jan 21 21:17:54 2024	superseded	nginx-0.1.0	1.16.0     	Install complete
2       	Sun Jan 21 21:46:04 2024	deployed  	nginx-0.2.0	1.16.0     	Upgrade completehelm rollback nginx-11 1
上传Harbor
修改Harbor
.....
harbor_admin_password: 123456
chart:absolute_url: enabled
......运行脚本
./install.shmkdir -p  ~/.local/share/helm/plugins/helm-pushtar -xf helm-push_0.8.1_linux_amd64.tar.gz -C ~/.local/share/helm/plugins/helm-pushdocker login -u admin -p 123456 https://hub.test.com上传
helm push nginx-0.2.0.tgz oci://hub.test.com/charts --insecure-skip-tls-verif

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/640977.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux C语言开发(十)vim基本操作

目录 一.什么是vim 二.vim的进入与退出 三.vim的基本模式 四.vim的命令行模式操作

SPA vs MPA vs PWA

1、单页面应用程序&#xff08;SPA&#xff09; ① 什么是 SPA SPA 全称为 Single-Page Application&#xff0c;表示单页面应用程序。 也就是说只有一个 HTML 文件的 Web 应用&#xff0c;我们通过 Vue 开发的项目其实就是典型的 SPA应用 在单页面应用程序中&#xff0c;我…

C语言——结构体讲解

目录 一、结构体类型的声明 二、结构体变量的定义和初始化 三、结构体的重命名 四、结构体的自引用 五、结构体内存对齐 六、结构体传参 七、结构体实现位段 7.1 什么是位段 7.2 位段的声明和使用 7.3 位段的空间大小计算 7.4 位段的内存分配 7.5 位段的跨平…

计算机网络-物理层基本概念(接口特性 相关概念)

文章目录 总览物理层接口特性星火模型给出的相关概念解释&#xff08;仅供参考&#xff09; 总览 求极限传输速率&#xff1a;奈氏准则&#xff0c;香农定理&#xff08;背景环境不一样&#xff09; 编码&#xff1a;数据变成数字信号 调制&#xff1a;数字信号变成模拟信号 信…

Elasticsearch:2023 年 Lucene 领域发生了什么?

作者&#xff1a;来自 Elastic Adrien Grand 2023 年刚刚结束&#xff0c;又是 Apache Lucene 开发活跃的一年。 让我们花点时间回顾一下去年的亮点。 社区 2023 年&#xff0c;有&#xff1a; 5 个次要版本&#xff08;9.5、9.6、9.7、9.8 和 9.9&#xff09;&#xff0c;1 …

51单片机LED点阵屏

LED点阵屏 LED点阵屏是一种由许多小型LED灯组成的矩阵式显示屏。这些LED灯可以是单色、双色或全彩的&#xff0c;它们排列成行和列的网格&#xff0c;可以根据需要点亮来显示图像、文字或动画等内容。LED点阵屏广泛应用于户外广告牌、室内显示、交通信号灯、电子价格标签和其他…

【设计模式】字节三面:请举例阐释访问者模式

今天我们要一起探讨的主题是一种设计模式——访问者模式(Visitor Pattern)。我将从最基础的概念、应用场景&#xff0c;再到实例代码的展示&#xff0c;全方位的为大家剖析访问者模式。而且&#xff0c;我保证&#xff0c;你即使是编程新手&#xff0c;也能理解并开始应用这个设…

如何在 Ubuntu 22.04 上安装 Linux、Apache、MySQL、PHP (LAMP) 堆栈

前些天发现了一个人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;最重要的屌图甚多&#xff0c;忍不住分享一下给大家。点击跳转到网站。 如何在 Ubuntu 22.04 上安装 Linux、Apache、MySQL、PHP (LAMP) 堆栈 介绍 “LAMP”堆栈是一组开源软件&#…

uniapp 在static/index.html中添加全局样式

前言 略 在static/index.html中添加全局样式 <style>div {background-color: #ccc;} </style>static/index.html源码&#xff1a; <!DOCTYPE html> <html lang"zh-CN"><head><meta charset"utf-8"><meta http-…

HCIA——21C/S、P2P、peer的选择

学习目标&#xff1a; 计算机网络 1.掌握计算机网络的基本概念、基本原理和基本方法。 2.掌握计算机网络的体系结构和典型网络协议&#xff0c;了解典型网络设备的组成和特点&#xff0c;理解典型网络设备的工作原理。 3.能够运用计算机网络的基本概念、基本原理和基本方法进行…

安全通信网络

1.网络架构 1&#xff09;应保证网络设备的业务处理能力满足业务高峰期需要。 设备CPU和内存使用率的峰值不大于设备处理能力的70%。 在有监控环境的条件下&#xff0c;应通过监控平台查看主要设备在业务高峰期的资源&#xff08;CPU、内存等&#xff09;使用 情况&#xff…

ES已有mapping下,新增字段且设置初始值

开发过程中随着业务的发展&#xff0c;内容累计&#xff0c;中途需要添加新的字段&#xff0c;并且设置初始值。 # 先查询原来的mapping GET test_index/_mapping # 新增字段 PUT test_index/_mapping {"properties": {"name": {"type": "…

【笔记】Disable APN 禁用数据连接的逻辑(Android KaiOS)

简介 通过OTA/OMADM 运营商服务器可以下发消息实现disable APN&#xff0c;从而影响Data PDN建立。APN被disable了会导致无法正常上网。 在Android 和 KaiOS 系统实现上有区别&#xff0c;不过都是通过carrier_enabled 这类字段实现判断控制。 Android&#xff1a;上层 Tele…

【Emotion】 自动驾驶最近面试总结与反思

outline 写在前面面试问题回顾和答案展望 写在前面 最近由于公司部门即将撤销&#xff0c;开始了新一轮准备。 发现现在整体行情不太乐观&#xff0c;很看过去的尤其是量产的经验 同时本次面试我coding环节答得不好&#xff0c;&#xff08;其实也是半年前大家问的比较简单…

fbx格式转换

目录 fbx转bvh bvh转fbx npz转换为fbx npz转换为fbx代码&#xff1a; convert2fbx.py fbx转bvh https://github.com/SinMDM/SinMDM/blob/0296efba20ae5875b6f1c092d277ea274e8ceda2/utils/fbx2bvh.py """ This code is a variation of https://github.co…

docker运行redis,jdk,nginx

Redis 1.查询redis [rootlocalhost ~]# docker search redis NAME DESCRIPTION STARS OFFICIAL redis Redis is an open source key-value store that… 12620 …

Vue关于router-link的使用和部分代码

//使用router-link和a标签差不多&#xff0c;重点是在vue-router中需要在对应的js文件中createRouter里面配置path的路径和createWebHistory&#xff08;createWebhashHistory&#xff09;的导入 //main.js中需要use(router),就可以进行路径的使用&#xff0c;下面是简单的写法…

白话编程--数据篇(1)基本数据类型

前言 数据是程序的另一个重要组成部分.对于程序的两个理解,一是在实现逻辑;二是在处理数据.综合起来,程序以处理数据的方式表达逻辑. 引入 什么是数据?数据的概念是相当广泛的.他相当于客观世界中的"物体".用一个桔子来做类比,我们可以把桔皮,桔梗,桔的汁液,桔的籽…

快速找到文件夹中匹配和不匹配的图片文件

一、脚本简介 在日常的软件开发和数据处理中&#xff0c;经常需要处理大量的文件和数据。针对一些分类的模型结果&#xff0c;这个脚本可以帮助快速找到文件夹中匹配和不匹配的图片文件。 二、完整代码 import osdef find_mismatched_images(folder1, folder2, subfolder):#…

04 双向链表

目录 1.双向链表 2.实现 3.OJ题 4.链表和顺序表对比 1. 双向链表 前面写了单向链表&#xff0c;复习一下 无头单向非循环链表&#xff1a;结构简单&#xff0c;一般不会单独用来存数据。实际中更多作为其他数据结构的子结构&#xff0c;如哈希桶、图的邻接等。另外这种结构在…