istio 安装与bookinfo示例运行
2024-08-28 08:28:55
目的
本文旨在帮助想了解istio安装和运行bookinfo示例的同学快速入门
前置准备
安装k8s和helm
1、k8s安装
修改主机名
hostnamectl set-hostname k8s-master
hostnamectl set-hostname k8s-node
配置阿里云yum源环境和gpg校验配置
docker-ce
/etc/yum.repos.d目录下
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo kubernetes
/etc/yum.repos.d目录下 vim kubenetes.repo [kubernetes]
name=Kubernetes Repo
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
enabled=1
gpg校验配置
wget https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
wget https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
rpm --import rpm-package-key.gpg
rpm --import yum-key.gpg
根据官方示例安装kubeadm(安装1.15.4版本k8s)
yum install -y docker-ce kubelet-1.15.4 kubeadm-1.15.4 kubectl-1.15.4
按照官方示例设置环境参数
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
kubeadm init运行使用阿里云镜像
kubeadm init \
--image-repository registry.aliyuncs.com/google_containers \
--pod-network-cidr=10.244.0.0/16
其中10.244.0.0/16是 flannel网络必加参数
2、helm安装
1.下载安装
wget https://get.helm.sh/helm-v2.14.3-linux-amd64.tar.gz
tar -zxf helm-v2.14.3-linux-amd64.tar.gz
cd linux-amd64
chmod +x helm
mv helm /usr/local/bin
2.确保您拥有一个为Tiller定义了集群管理员角色的服务帐户
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.3/install/kubernetes/helm/helm-service-account.yaml
3.使用阿里镜像安装tiller,同时将repo 改为微软提供的helm repo
helm init --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.3 --stable-repo-url http://mirror.azure.cn/kubernetes/charts/ --service-account=tiller
Istio安装
1.下载安装包
参考地址:https://istio.io/docs/setup/#downloading-the-release
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.3.1 sh -
cd istio-1.3.1
export PATH=$PWD/bin:$PATH
2.通过helm install与Helm和Tiller一起安装istio
参考地址: https://istio.io/docs/setup/install/helm/
使用kubectl apply安装所有Istio自定义资源定义(CRD),并等待几秒钟以在Kubernetes API服务器中提交CRD:
helm install install/kubernetes/helm/istio-init --name istio-init --namespace istio-system --set gateways.istio-ingressgateway.type=NodePort
使用以下命令验证是否已将所有23个Istio CRD都提交给Kubernetes api服务器:
kubectl get crds | grep 'istio.io' | wc -l
选择一个配置文件,然后安装与您选择的文件相对应的istio图表:
helm install install/kubernetes/helm/istio --name istio --namespace istio-system \
--values install/kubernetes/helm/istio/values-istio-demo.yaml \
--set gateways.istio-ingressgateway.type=NodePort
3.运行bookinfo示例
参考地址: https://istio.io/docs/examples/bookinfo/
kubectl label namespace default istio-injection=enabled
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
kubectl get pods
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
export INGRESS_HOST=<k8s-node ip>
export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
浏览器访问http://${GATEWAY_URL}/productpage
更多示例参考:https://istio.io/docs/tasks/
最新文章
- Python (一) 简介、安装
- Linux安全基础:shell及一些基础命令
- WPF 自定义雷达图
- C语言三维数组分解
- 造轮子之数据库对比工具DataBaseComparer
- linux 驱动学习笔记01--Linux 内核的编译
- mysql下一个版本应该且实现并不复杂增加的常用功能
- [整理]iOS开发学习
- js 实现复制到剪切板 复制按钮兼容各大浏览器
- android Timer and TImerTask
- mongodb日志服务器方案
- webrtc学习——RTCPeerConnection
- Android EditText自动弹出输入法焦点
- linux允许root远程登录
- Leetcode 4
- RBAC用户特别授权的思考
- 微信小程序页面导航功能
- grep匹配某个次出现的次数
- kafka监控kafka-eagle 容器化配置
- mysql 由decimal 引起的 Warning: Data truncated for column
热门文章
- scrapy 框架持久化存储的三个方法 存入 mysql 文件 redis
- MyBatis 源码篇-插件模块
- hdu 6045 多校签到题目
- git merge 命令的使用
- ie/chorme 清除缓存 刷新js,css
- Maven错误:警告Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published
- 转自:java 文件格式二进制头文件校验
- 1.SpringMVC 概述
- 30K以上的高薪Java程序员所需技能大汇总
- PAT Basic 1083 是否存在相等的差 (20 分)