前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Cilium Hubble UI 可观测网络学习

Cilium Hubble UI 可观测网络学习

作者头像
tanmx
发布2023-10-18 12:50:06
3260
发布2023-10-18 12:50:06
举报

接上文《使用 k3s 搭建 cilium + istio 实验环境》和 《istio-ingressgateway 学习

一、暴露 hubble ui

通过 istio-ingressgateway 暴露 hubble ui 服务,执行以下步骤:

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 32 33 34 35

kubectl apply -f - <<EOF apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: istio-gateway spec: selector: istio: ingressgateway # use Istio default gateway implementation servers: - port: number: 80 name: http protocol: HTTP hosts: - "hubble.k3s.local" --- apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: hubble-vs spec: hosts: - "hubble.k3s.local" gateways: - istio-gateway http: - match: - uri: prefix: / route: - destination: port: number: 80 host: hubble-ui.kube-system.svc.cluster.local EOF

hubble ui 通过sub path 子路径这种访问方式有问题,这里通过子域名的方式访问,在本机 hosts 文件 配置如下内容

1 2

istio-ingressgateway vpsIP hubble.k3s.local

浏览器访问http://hubble.k3s.local:31782/(31782 为 istio-ingressgateway 的nodeport)

二、实验测试

1. Star Wars demo

部署 cilium 官方示例实例: Star Wars Demo 官方的 yaml 没有 arm 版本的镜像,这里稍作修改:

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

kubectl apply -f - <<EOF --- apiVersion: v1 kind: Service metadata: name: deathstar labels: app.kubernetes.io/name: deathstar spec: type: ClusterIP ports: - port: 80 selector: org: empire class: deathstar --- apiVersion: apps/v1 kind: Deployment metadata: name: deathstar labels: app.kubernetes.io/name: deathstar spec: replicas: 2 selector: matchLabels: org: empire class: deathstar template: metadata: labels: org: empire class: deathstar app.kubernetes.io/name: deathstar spec: containers: - name: deathstar image: docker.io/yuspin/starwars --- apiVersion: v1 kind: Pod metadata: name: tiefighter labels: org: empire class: tiefighter app.kubernetes.io/name: tiefighter spec: containers: - name: spaceship image: docker.io/wrype/netperf-latest --- apiVersion: v1 kind: Pod metadata: name: xwing labels: app.kubernetes.io/name: xwing org: alliance class: xwing spec: containers: - name: spaceship image: docker.io/wrype/netperf-latest EOF

成功部署后,从两个宇宙飞船发出请求以模拟 一些流量。

1 2 3 4 5

$ kubectl exec xwing -- curl -s -XPOST deathstar.default.svc.cluster.local/v1/request-landing Ship landed $ kubectl exec tiefighter -- curl -s -XPOST deathstar.default.svc.cluster.local/v1/request-landing Ship landed

然后这些请求将在 hubble ui 显示为不同的 pod 间的服务调用

2. 检查各种网络流量

为了制造一些网络流量,循环运行 cilium 的连通性检测程序

1

while true; do cilium connectivity test; done

然后可以在 hubble ui,看到各种网络流量

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2023-09-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、暴露 hubble ui
  • 二、实验测试
    • 1. Star Wars demo
    • 2. 检查各种网络流量
    相关产品与服务
    容器服务
    腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档