CC00020.CloudKubernetes——|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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yanqi_vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值