使用 Helm Chart 部署及卸载 istio

部署 istio

1.添加 istio 官方的 helm 仓库

helm repo add istio   https://storage.googleapis.com/istio-release/releases/1.3.3/charts/

2.是否添加成功

helm search repo istio

NAME CHART VERSION APP VERSION DESCRIPTION
istio/istio 1.3.3 1.3.3 Helm chart for all istio components
istio/istio-cni 1.3.3 1.3.3 Helm chart for istio-cni components
istio/istio-init 1.3.3 1.3.3 Helm chart to initialize Istio CRDs

3.创建 istio-system 命名空间

kubectl create ns istio-system

4.创建 istio 所需的 crd 文件

helm install istio-init istio/istio-init -n istio-system

5.检查 CRD 文件是否创建完成,输出为23

kubectl get crds | grep 'istio.io' | wc -l

23

6.部署 istio

helm install istio istio/istio -n istio-system

NAME: istio
LAST DEPLOYED: Thu Oct 24 12:05:06 2019
NAMESPACE: istio-system
STATUS: deployed
REVISION: 1
NOTES:
Thank you for installing Istio.

Your release is named Istio.

To get started running application with Istio, execute the following steps:

  1. Label namespace that application object will be deployed to by the following command (take default namespace as an example)

kubectl label namespace default istio-injection=enabled
? kubectl get namespace -L istio-injection

  1. Deploy your applications

$ kubectl apply -f .yaml

For more information on running Istio, visit:
https://istio.io/

卸载 istio

1.卸载 istio

helm -n istio-system uninstall istio

2.删除 istio crd 文件

helm -n istio-system uninstall istio-init

kubectl delete crd `kubectl get crd | grep istio| awk '{print $1}'`

一键部署及卸载 istio 的脚本

部署脚本

#!/bin/bash

# Add istio official repo
add_repo(){
  VERSION=$1
  REPO="https://storage.googleapis.com/istio-release/releases/${VERSION}/charts/"
  helm repo add istio $REPO

  STATUS_CMD=`echo $?`
  CHECK_REPO_CMD=`helm repo list | grep $REPO | wc -l`
  echo "$STATUS_CMD"
  echo "$CHECK_REPO_CMD"
  while [[ $STATUS_CMD != 0 && $CHECK_REPO_CMD -ge 1 ]]
  do
    sleep 5
    helm repo add istio $REPO

    STATUS_CMD=`echo $?`
    CHECK_REPO_CMD=`helm repo list | grep $REPO | wc -l`
  done
}

# Create istio-system namespace
create_namespace() {
  NAMESPACE=$1
  kubectl create ns ${NAMESPACE}

  STATUS_CMD=`echo $?`
  while [[ $STATUS_CMD != 0 ]]
  do
    sleep 5
    kubectl create ns ${NAMESPACE}
    STATUS_CMD=`echo $?`
  done
}

# Create CRD need for istio
create_crd() {
  NAMESPACE=$1
  helm install istio-init istio/istio-init -n ${NAMESPACE}
  CRD_COUNT=`kubectl get crds | grep 'istio.i' | wc -l`

  while [[ ${CRD_COUNT} != 23 ]]
  do
    sleep 5
    CRD_COUNT=`kubectl get crds | grep 'istio.io' | wc -l`
  done

  echo 'Istio crd create successful'
}

# Deploy istio related components
deploy_istio() {
  NAMESPACE=$1
  VERSION=$2
  helm install istio istio/istio -n ${NAMESPACE}

  check() {
     kubectl -n ${NAMESPACE}  get deploy | grep istio | awk '{print "deployment/"$1}' | while read line ;
     do
       kubectl rollout status $line -n ${NAMESPACE};
     done
  }
  check

  echo "Istio is deployed successful"
}

main(){
  ISTIO_VERSION="1.3.3"
  ISTIO_NAMESPACE="istio-system"
  add_repo $ISTIO_VERSION
  if [[ `kubectl get ns | grep $ISTIO_NAMESPACE | wc -l ` == 0 && `kubectl get ns $ISTIO_NAMESPACE | grep -v NAME | wc -l` == 0 ]] ;then
    create_namespace $ISTIO_NAMESPACE
  fi
  create_crd $ISTIO_NAMESPACE
  deploy_istio $ISTIO_NAMESPACE $ISTIO_VERSION
}

main

卸载脚本

#!/bin/bash

helm -n istio-system uninstall istio
helm -n istio-system uninstall istio-init
kubectl delete crd `kubectl get crd | grep istio | awk '{print $1}'`
kubectl delete ns istio-system

注意:卸载需谨慎,删除了 istio-system 的命名空间

总结

上述步骤使用的是 istio 官方提供的默认配置,如果你想要自定配置,可以阅读 values.yaml 文件后,通过 --set 的方式修改,或者直接修改 chart。

本文由博客一文多发平台 OpenWrite 发布!

原文地址:https://www.cnblogs.com/innerpeacez/p/11757484.html

时间: 2024-08-25 17:30:14

使用 Helm Chart 部署及卸载 istio的相关文章

k8s中helm安装部署,升级和回滚(chart,helm,tiller,StorageClass)

一.Helm介绍 helm是基于kubernetes 的包管理器.它之于 kubernetes 就如 yum 之于 centos,pip 之于 python,npm 之于 javascript 那 helm 的引入对于管理集群有哪些帮助呢? 更方便地部署基础设施,如 gitlab,postgres,prometheus,grafana 等 更方便地部署自己的应用,为公司内部的项目配置 Chart,使用 helm 结合 CI,在 k8s 中部署应用一行命令般简单 1.Helm用途 Helm把Kub

Kubernetes 与 Helm:使用同一个 Chart 部署多个应用

k8s 集群搭建好了,准备将 docker swarm 上的应用都迁移到 k8s 上,但需要一个一个应用写 yaml 配置文件,不仅要编写 deployment.yaml 还要编写 service.yaml ,而很多应用的配置是差不多的,这个繁琐工作让人有些望而却步. k8s 有没有针对这个问题的解救之道呢?发现了救星 Helm -- k8s 应用程序包管理器,实际操作体验一下. 首先在 k8s master 节点上安装 helm ,用下面的1行命令就可以搞定. curl https://raw

k8s实践17:监控利器prometheus helm方式部署配置测试

监控利器prometheus helm方式部署配置测试 1.部署helm 部署helm参考方法 后面使用helm部署grafana和prometheus,因此首先需要部署helm,保证helm能正常使用. 部署helm客户端过程见下: [[email protected] helm]# curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh % Total % Receive

openshift 4.3中安装helm3并通过helm方式部署应用

openshift 4.3中安装helm3并通过helm方式部署应用 简介 Helm是一个命令行界面(CLI)工具,可简化将应用程序和服务部署到OpenShift Container Platform集群的过程. Helm使用一种称为chart的包格式. Helm chart 是描述OpenShift容器平台资源的文件集. 在openshift中部署Helm,我们可以获得以下效益: 充分利用k8s helm部署大量ocp operator hub没有的应用,比如gitlab新版本就只支持helm

windows服务部署与卸载

同事问到windows service的东东,现在整理一下,用c#如何创建一个windows service,以及如何调试.部署.卸载. 一.创建windows service 1. 打开VS2008,新建一个Project, Project类型选择Visual C#-Windows,在Templates中选择Windows Service, 其他可以默认,点击OK. 2. 在Solution Explorer中会看到自动产生了三个文件:app.config, Program.cs,Servic

发布 HashiCorp Consul Helm Chart

SEP 12 2018?MITCHELL HASHIMOTO We're releasing?HashiCorp Consul + Kubernetes?features every week. This week we're releasing the?official Consul Helm Chart?for running and configuring Consul on Kubernetes. Using the Helm chart, you can start a complet

harbor配置helm chart仓库

harbor配置helm chart仓库1.harbor 安装的时候 默认没有helm charts的仓库,如果已经安装过重新执行安装即可,不需要preparedocker-compose stop./install.sh --with-chartmuseum安装完成之后登录页面上就会有了 helm charts 了,页面上也可以直接上传charts 2.helm 需要安装插件并添加源,需要harbor登陆用户密码helm plugin install https://github.com/ch

k8s/Kubernetes常用组件Helm的部署

Helm的安装 1.Helm的基本概念 Helm是Kubernetes的一个包管理工具,用来简化Kubernetes应用的部署和管理.可以把Helm比作CentOS的yum工具. Helm有如下几个基本概念: Chart: 是Helm管理的安装包,里面包含需要部署的安装包资源.可以把Chart比作CentOS yum使用的rpm文件.每个Chart包含下面两部分: 包的基本描述文件Chart.yaml 放在templates目录中的一个或多个Kubernetes manifest文件模板 Rel

蓝鲸智云社区版安装部署和卸载

1.检查每台机器环境 1 # 检查SELinux的状态,enabled即为开启,disabled即为禁用 2 sestatus 3 getenforce 4 /usr/sbin/sestatus -v 5 # 先通过命令禁用SELinux 6 setenforce 0 7 # 再修改配置文件 8 sed -i '$ sed -i 's/^SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux' 9 # 重启下机器(谨慎) 10 r