备考ICA----Istio实验13---使用 Istio Ingress 暴露应用

备考ICA----Istio实验13---使用Istio Ingress TLS暴露应用

1. 环境部署

清理之前实验遗留,并重新部署httpbin服务进行测试

bash 复制代码
# 清理之前的环境
kubectl delete vs httpbin
kubectl delete gw mygateway
# 部署httpbin
kubectl apply -f istio/samples/httpbin/httpbin.yaml 

确认应用被正确创建

bash 复制代码
kubectl get deployments,svc httpbin

2. 为httpbin创建ingress

创建一个ingress指向httpbin服务,测试服务本身是否正常

bash 复制代码
kubectl create ingress httpbin-ingress \
 --rule 'httpbin.example.com/status*=httpbin:8000' \
 --annotation kubernetes.io/ingress.class=istio

确认ingress被正确创建

bash 复制代码
kubectl get ingress

访问测试

bash 复制代码
curl -s -I -HHost:httpbin.example.com "http://192.168.126.220/status/200"

3. 为httpbin创建ingress TLS

通过IngressClass连接istio.io/ingresss-controller将流量转给httpbin服务

3.1 创建 Istio ingressclass

ingress/IngressClass.yaml

yaml 复制代码
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: istio
spec:
  controller: istio.io/ingress-controller

部署istio ingressclass

bash 复制代码
kubectl apply -f ingress/IngressClass.yaml

3.2 调用Istio Ingressclass

重建httpbin的ingress

bash 复制代码
kubectl delete ingress httpbin-ingress
kubectl create ingress httpbin-ingress \
 --rule 'httpbin.example.com/status*=httpbin:8000' \
 --class istio
kubectl get ingress

访问测试

bash 复制代码
curl -s -I -HHost:httpbin.example.com "http://192.168.126.220/status/200"

3.3 使用 TLS ingress

bash 复制代码
kubectl delete ingress httpbin-ingress
kubectl create secret tls httpbin-credential \
--key=example_certs_httpbin/httpbin.example.com.key \
--cert=example_certs_httpbin/httpbin.example.com.crt 
kubectl create ingress httpbin-ingress \
 --rule 'httpbin.example.com/status*=httpbin:8000,tls=httpbin-credential' \
 --class istio

确认hosts中存在httpbin.example.com的解析,访问测试

bash 复制代码
curl -k -vvv https://httpbin.example.com

可以看到证书已经被加载

到浏览器中查看证书详情,也是和我们之前生成并绑定的证书相符

至此备考ICA----Istio实验13---使用 Istio Ingress 暴露应用实验完成

相关推荐
青槿吖15 小时前
Sentinel 进阶实战:Feign 整合 + 全局异常 + Nacos 持久化,生产环境直接用
java·开发语言·spring cloud·微服务·云原生·ribbon·sentinel
米高梅狮子15 小时前
04.yaml和Kubernetes Pod精讲
云原生·容器·kubernetes
没有口袋啦16 小时前
基于K8s+Karmada的混合多云容器平台项目(Ubuntu22.04)(还在持续打磨中)
云原生·容器·kubernetes
风翼靓崽16 小时前
记一次k8s pod的CrashLoopBackOff错误状态
云原生·容器·kubernetes
cyber_两只龙宝16 小时前
【Oracle】Oracle之SQL的集合运算符
linux·运维·数据库·sql·云原生·oracle
Elastic 中国社区官方博客16 小时前
自动化可靠性:自愈型企业的架构
运维·elasticsearch·搜索引擎·云原生·架构·自动化·serverless
喜欢流萤吖~17 小时前
微服务的统一大门:SpringCloud Gateway
微服务·云原生·架构
AOwhisky17 小时前
Kubernetes 学习笔记:Volume 存储卷与 ConfigMap 配置管理
linux·运维·笔记·学习·云原生·kubernetes
梦梦代码精17 小时前
LikeShop 深度测评:开源电商的务实之选
java·前端·数据库·后端·云原生·小程序·php
yuanlaile17 小时前
NestJS实战商城与云原生落地指南
云原生·nestjs·nestjs学习指南