。 $ scp $WORK_DIR/* [USERNAME]@[INSTANCE_IP]:~ Enter passphrase for key '/Users/peterj/.ssh/id_rsa': bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) cluster.env100%58912.6KB/s00:00 hosts100%380.8KB/s00:00 istio-token100%90619.4KB/s00:00 mesh.yaml100%66714.4KB/s00:00 root-cert.pem100% 109423.5KB/s00:00或者,你可以使用 gcloud 命令和实例名称: gcloud compute scp --zone=us-west1-b ${WORK_DIR}/* [INSTANCE_NAME]:~ 。
- SSH 进入实例,将根证书复制到 /etc/certs:
 sudo mkdir -p /etc/certs sudo cp root-cert.pem /etc/certs/root-cert.pem- 拷贝 istio-token文件到/var/run/secrets/tokens目录:
 sudo mkdir -p /var/run/secrets/tokens sudo cp istio-token /var/run/secrets/tokens/istio-token- 下载和安装 Istio sidecar 包:
 curl -LO https://storage.googleapis.com/istio-release/releases/1.10.3/deb/istio-sidecar.deb sudo dpkg -i istio-sidecar.deb- 拷贝 cluster.env到/var/lib/istio/envoy/:
 sudo cp cluster.env /var/lib/istio/envoy/cluster.env- 将 Mesh 配置(mesh.yaml)添加到/etc/istio/config/mesh:
 sudo cp mesh.yaml /etc/istio/config/mesh- 将 istiod host 添加到 /etc/hosts文件中:
 sudo sh -c 'cat $(eval echo ~$SUDO_USER)/hosts >> /etc/hosts'- 将 /etc/certs和/var/lib/istio/envoy的所有者修改为 Istio proxy:
 sudo mkdir -p /etc/istio/proxy sudo chown -R istio-proxy /var/lib/istio /etc/certs /etc/istio/proxy /etc/istio/config /var/run/secrets /etc/certs/root-cert.pem以上都就绪后,就可以在虚拟机中启动 Istio: sudo systemctl start istio此刻,虚拟机被配置为与 Kubernetes 集群中 Istio 的控制平面通信 。4.5 从虚拟机访问服务让我们在 Kubernetes 集群中部署一个 Hello world 应用程序 。首先,我们需要在
default 命名空间中启用自动 sidecar 注入: $ kubectl label namespace default istio-injection=enabled namespace/default labeled接下来,创建 Hello world 的部署和服务 。 apiVersion: apps/v1 kind: Deployment metadata:name: hello-worldlabels:app: hello-world spec:replicas: 1selector:matchLabels:app: hello-worldtemplate:metadata:labels:app: hello-worldspec:containers:- image: gcr.io/tetratelabs/hello-world:1.0.0imagePullPolicy: Alwaysname: svcports:- containerPort: 3000 --- kind: Service apiVersion: v1 metadata:name: hello-worldlabels:app: hello-world spec:selector:app: hello-worldports:- port: 80name: httptargetPort: 3000将上述文件保存为 hello-world.yaml,并使用 kubectl apply -f hello-world.yaml 进行部署 。等待 Pod 准备好,然后回到虚拟机上,尝试访问 Kubernetes 服务:
【十一 Istio:向istio服务网格中引入虚拟机】
 $ curl http://hello-world.default Hello World你可以从虚拟机上访问在你的 Kubernetes 集群内运行的任何服务 。4.6 在虚拟机上运行服务我们也可以在虚拟机上运行一个工作负载 。切换到实例上,运行一个简单的 Python HTTP 服务器:
 $ sudo python3 -m http.server 80 Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...如果你试图直接 curl 到实例 IP,你会得到一个响应(目录列表) 。: $ curl [INSTANCE_IP] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dt d"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Directory listing for /</title> </head> <body> <h1>Directory listing for /</h1> <hr> ...但我们要做的是将工作负载(Python HTTP 服务)添加到网格中 。出于这个原因 , 我们在前面创建了虚拟机命名空间 。所以让我们创建一个代表虚拟机工作负载的 Kubernetes 服务 。注意 , 名称和标签值等于我们之前设置的 VM_APP 环境变量的值 。不要忘记将服务部署到 VM_NAMESPACE 。 apiVersion: v1 kind: Service metadata:name: hello-vmlabels:app: hello-vm spec:ports:- port: 80name: http-vmtargetPort: 80selector:app: hello-vm将上述文件保存为 hello-vm-service.yaml,并使用 kubectl apply -f hello-vm-service.yaml -n vm-namespace 将其部署到 VM 命名空间 。因为我们没有使用实验性的虚拟机自动注册,它将自动创建 WorkloadEntry 资源,我们需要手动创建它们 。
我们需要一个代表虚拟机工作负载的 WorkloadEntry 资源——该资源使用虚拟机服务账户(
推荐阅读
- 九 Istio:istio安全之授权
- Python数据分析:实用向
- 五 Istio:使用服务网格Istio进行流量路由
- 二 Istio:在Kubernetes(k8s)集群上安装部署istio1.14
- 二 Three光线检测-实现摄像机向鼠标点击位置滑动动画
- 文本挖掘与NLP笔记——代码向:分词
- 双十一iqooneo5手机能便宜多少_双十一iqooneo5价格
- SpringCloud怎么迈向云原生?
- 【vue2】Style和Class,条件,列表渲染,双向数据绑定,事件处理
- el-cascader组件根据最后一级向上找到父级并设置默认值

 
   
   
   
   
   
   
   
   
   
  