|NO.Z.00020|——————————|CloudNative|——|Kubernetes&RBAC介绍.V03|——|helm|

一、Helm
二、helm概述
~~~     helm官网地址:
### --- 之前方式部署应用基本操作
~~~     部署一个nginx应用;导出为yaml文件

[root@k8s-master ~]# kubectl create deployment nginx --image=nginx -o yaml
### --- 对外暴露端口,创建一个services

[root@k8s-master ~]# kubectl expose deployment nginx --port=80 --target-port=80 --type=NodePort
[root@k8s-master ~]# kubectl get pods                   # 查看Pod
[root@k8s-master ~]# kubectl get svc                    # 查看services

一、helm快速部署应用:helm官网地址:https://helm.sh/docs/intro/quickstart/
三、使用helm部署应用
### --- 将helm-v3.0.0-linux-amd64.tar.gz该软件包上传到服务器并解压

[root@k8s-master ~]# tar -zxvf helm-v3.0.0-linux-amd64.tar.gz 
### --- 将helm执行文件放到可以执行目录下
[root@k8s-master linux-amd64]# mv helm /usr/bin/

~~~     验证helm是否可以使用,只要有输出内容,说明输出正常
[root@k8s-master linux-amd64]# helm 
### --- 配置helm仓库
~~~		添加微软的仓库地址

[root@k8s-master linux-amd64]# helm repo add stable http://mirror.azure.cn/kubernetes/charts     #仓库名称+仓库地址
"stable" has been added to your repositories
~~~		查看仓库地址

[root@k8s-master linux-amd64]# helm repo list   
NAME    URL                                     
stable  http://mirror.azure.cn/kubernetes/charts
~~~		添加aliyun的仓库地址

[root@k8s-master linux-amd64]# helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
"aliyun" has been added to your repositories
[root@k8s-master linux-amd64]# helm repo list
NAME    URL                                                   
stable  http://mirror.azure.cn/kubernetes/charts              
aliyun  https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
~~~		可以更新仓库包
[root@k8s-master linux-amd64]# helm repo update

~~~		删除仓库源地址
[root@k8s-master linux-amd64]# helm repo remove aliyun          
"aliyun" has been removed from your repositories

~~~		查看仓库源后结构,只有微软的仓库源                            
[root@k8s-master linux-amd64]# helm repo list               
stable  http://mirror.azure.cn/kubernetes/charts
### --- 使用helm快速部署应用
~~~		# 第一步:使用命令搜索应用
~~~		命令格式:helm search repo 名称 (weave)

[root@k8s-master ~]# helm search repo weave
NAME                CHART VERSION   APP VERSION DESCRIPTION                                       
stable/weave-cloud  0.3.9           1.4.0       DEPRECATED - Weave Cloud is a add-on to Kuberne...
stable/weave-scope  1.1.12          1.12.0      DEPRECATED - A Helm chart for the Weave Scope c...
~~~		# 根据所索到的内容进行选择安装
~~~		命令格式:helm install 安装之后名称  搜索之后应用的名称 

[root@k8s-master ~]# helm install ui stable/weave-scope
NAME: ui
LAST DEPLOYED: Tue Feb 23 19:32:04 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
You should now be able to access the Scope frontend in your web browser, by
using kubectl port-forward:

kubectl -n default port-forward $(kubectl -n default get endpoints \
ui-weave-scope -o jsonpath='{.subsets[0].addresses[0].targetRef.name}') 8080:4040

then browsing to http://localhost:8080/.
For more details on using Weave Scope, see the Weave Scope documentation:

https://www.weave.works/docs/scope/latest/introducing/
~~~		# 查看它的状态
~~~		命令格式:helm list
~~~		命令格式某个具体的:helm status 安装之后名称:
~~~		查看安装状态

[root@k8s-master ~]# helm list                              
NAME    NAMESPACE   REVISION    UPDATED                                 STATUS      CHART               APP VERSION
ui      default     1           2021-02-23 19:32:04.316266249 +0800 CST deployed    weave-scope-1.1.12  1.12.0    
 ~~~		查看详细信息

[root@k8s-master ~]# helm status ui                         
NAME: ui
LAST DEPLOYED: Tue Feb 23 19:32:04 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
You should now be able to access the Scope frontend in your web browser, by
using kubectl port-forward:

kubectl -n default port-forward $(kubectl -n default get endpoints \
ui-weave-scope -o jsonpath='{.subsets[0].addresses[0].targetRef.name}') 8080:4040

then browsing to http://localhost:8080/.
For more details on using Weave Scope, see the Weave Scope documentation:

https://www.weave.works/docs/scope/latest/introducing/ 
### --- 通过kubectl查看部署的应用

[root@k8s-master ~]# kubectl get pods
weave-scope-agent-ui-6cfhf                      1/1     Running     0          3m13s
weave-scope-agent-ui-gfkbh                      1/1     Running     0          3m13s
weave-scope-agent-ui-sjmrw                      1/1     Running     0          3m13s
weave-scope-cluster-agent-ui-7498b8d4f4-ck66v   1/1     Running     0          3m13s
weave-scope-frontend-ui-649c7dcd5d-kxptj        1/1     Running     0          3m13s
~~~		查看没有对外暴露端口

[root@k8s-master ~]# kubectl get svc                    
ui-weave-scope   ClusterIP   10.98.111.244   <none>        80/TCP         4m2s 
~~~		修改对外暴露端口

[root@k8s-master ~]#  kubectl edit svc ui-weave-scope
service/ui-weave-scope edited
spec:
  clusterIP: 10.98.111.244
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  selector:
    app: weave-scope
    component: frontend
    release: ui
  sessionAffinity: None
  type: NodePort                                # 修改对外暴露端口
~~~		# 端口号暴露配置完成

[root@k8s-master ~]# kubectl get svc                    
ui-weave-scope   NodePort    10.98.111.244   <none>        80:32212/TCP   6m35s 

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(7)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示