0
点赞
收藏
分享

微信扫一扫

Service mesh 学习05 istio初步使用

司马吹风 2023-10-05 阅读 43

一、初步感受istio

在docker中是通过container来部署业务的,在k8s里面是通过pod来部署业务的,那么在istio里面如何体现sidecar呢?

猜想:会不会在pod中除了业务需要的container之外还会有一个sidecar的container存在呢?

准备资源 vi first-istio.yaml

apiVersion: apps/v1 ## 定义了一个版本
kind: Deployment ##资源类型是Deployment
metadata:
    name: first-istio 
spec:
    selector:
       matchLabels:
         app: first-istio
    replicas: 1
    template:
       metadata:
         labels:
           app: first-istio
       spec:
         containers:
      - name: first-istio ##容器名字  下面容器的镜像
           image: registry.cn-hangzhou.aliyuncs.com/sixupiaofei/spring-docker-demo:1.0
           ports:
        - containerPort: 8080 ##容器的端口
---
apiVersion: v1
kind: Service ##资源类型是Service
metadata:
    name: first-istio ##资源名字first-istio
spec:
    ports:
  - port: 80 ##对外暴露80
       protocol: TCP ##tcp协议
       targetPort: 8080 ##重定向到8080端口
    selector:
       app: first-istio ##匹配合适的label,也就是找到合适pod
    type: ClusterIP ## Service类型ClusterIP


举报

相关推荐

0 条评论