Integrating Virtual Machines

本文介绍如何使用Istio服务网格在Kubernetes集群与虚拟机之间部署Bookinfo应用,并通过实例说明如何在VM上安装MySQL作为ratings服务的后端,以及如何将其注册到Istio服务网格中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这个例子跨k8s和一些虚拟机来部署Bookinfo,讲述如何使用Istio服务网格将这个架构当作单一网格进行操作。

注意:这个指南还在开发阶段,并且仅在Google Cloud平台进行了测试。在IBM Cloud或其他平台上隔离VM网络并覆盖Pod网络的情况下,即使使用Istio,VM也不能和K8s Pods进行任何直接通信。

Overview

这里写图片描述

Before you begin

  • 按照 Installation guide 的指示安装Istio。
  • 部署 Bookinfo 示例应用(在命名空间bookinfo 中)
  • 在与Istio集群相同的项目中创建一个名为 ‘vm-1’的VM,并 Join the Mesh

Running mysql on the VM

我们首先在VM中安装mysql,并把它配置成ratings服务的后端服务。
在VM上:

sudo apt-get update && sudo apt-get install -y mariadb-server
sudo mysql
# Grant access to root
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
quit;
sudo systemctl restart mysql

你可以在Mysql 中找到更多关于mysql配置的细节。
在VM上将ratings的数据添加到mysql中:

# Add ratings db to the mysql db
curl -q https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/src/mysql/mysqldb-init.sql | mysql -u root -ppassword

为了便于直观的检查bookinfo应用的输出差异,可以使用下列命令生成ratings:

# To inspect the ratings
mysql -u root -ppassword test -e "select * from ratings;"
+----------+--------+
| ReviewID | Rating |
+----------+--------+
|        1 |      5 |
|        2 |      4 |
+----------+--------+
# To change the ratings
mysql -u root -ppassword test -e  "update ratings set rating=1 where reviewid=1;select * from ratings;"
+----------+--------+
| ReviewID | Rating |
+----------+--------+
|        1 |      1 |
|        2 |      4 |
+----------+--------+

Find out the IP address of the VM that will be used to add it to the mesh

在VM上:

hostname -I

Registering the mysql service with the mesh

在可以使用istioctl 命令的主机上,注册VM和mysql db服务

istioctl register -n vm mysqldb <ip-address-of-vm> 3306

输出如下:

$ istioctl register -n vm mysqldb 10.150.0.5 3306
I1108 20:17:54.256699   40419 register.go:43] Registering for service 'mysqldb' ip '10.150.0.5', ports list [{3306 mysql}]
I1108 20:17:54.256815   40419 register.go:48] 0 labels ([]) and 1 annotations ([alpha.istio.io/kubernetes-serviceaccounts=default])
W1108 20:17:54.573068   40419 register.go:123] Got 'services "mysqldb" not found' looking up svc 'mysqldb' in namespace 'vm', attempting to create it
W1108 20:17:54.816122   40419 register.go:138] Got 'endpoints "mysqldb" not found' looking up endpoints for 'mysqldb' in namespace 'vm', attempting to create them
I1108 20:17:54.886657   40419 register.go:180] No pre existing exact matching ports list found, created new subset {[{10.150.0.5  <nil> nil}] [] [{mysql 3306 }]}
I1108 20:17:54.959744   40419 register.go:191] Successfully updated mysqldb, now with 1 endpoints

注意 ‘mysqldb’虚拟机不需要也不应该有特殊的k8s权限。

Using the mysql service

bookinfo的ratings服务将使用机器上的数据库。为了验证它是否工作,创建使用VM mysql db的v2版本ratings服务。然后指定路由规则,强制review服务使用v2版本的ratings服务。

# Create the version of ratings service that will use mysql back end
istioctl kube-inject -n bookinfo -f samples/bookinfo/kube/bookinfo-ratings-v2-mysql-vm.yaml | kubectl apply -n bookinfo -f -
# Create route rules that will force bookinfo to use the ratings back end
istioctl create -n bookinfo -f samples/bookinfo/kube/route-rule-ratings-mysql-vm.yaml

你可以确认book nfo应用的输出,Reviewer1 展示1星,Reviewer2 展示4星,或者改变你的VM上的ratings并查看结果。

同时,你可以在 RawVM MySQL 文档中发现一些故障和其他信息。

### Realsense D430 Driver Download and Installation Guide For the installation of drivers related to hardware such as the Realsense D430, it is important to follow a specific procedure that ensures compatibility with the operating system being used. The official Intel website provides detailed instructions on downloading and installing the RealSense SDK which includes necessary drivers for devices like the D430 model[^1]. Users should visit this site directly from their web browser using an address similar to `https://www.intelrealsense.com/sdk-2/`. Once at the page: - Select 'Download' option available. - Choose appropriate package according to your platform (Windows, Linux). - Follow prompts through installer process carefully noting any special requirements or dependencies mentioned during setup. After completing these steps successfully, users may need additional configuration depending upon intended application usage scenarios involving the camera device. For instance, integrating into virtual machines might require further adjustments beyond initial driver setup described here. ```bash sudo apt-get update && sudo apt-get install librealsense2-dkms librealsense2-utils \ librealsense2-dev libuvc-0.0.5-dev realsense-camera-calibration ``` This command installs several packages including kernel modules (`dkms`), utilities(`utils`), development files(`dev`) along with UVC support and calibration tools specifically designed for working effectively alongside Intel® RealSense™ cameras under certain distributions of GNU/Linux systems.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值