k8sdeploy配置文件示例

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: [k8s服务名]
  namespace: default
  labels:
    k8s-app: [k8s服务名]
spec:
  replicas: 1
  template:
    metadata:
      labels:
        k8s-app: [k8s服务名]
    spec:
      hostAliases:
        - ip: "[ip白名单]"
          hostnames:
          - "[域名]"
          - "[域名]"
        - ip: "ip白名单"
          hostnames:
          - "[域名]"
          - "[域名]"
      initContainers:
        - name: init-agent
          image: [ip]:[端口]/skywalking-agent:8.6.0
          imagePullPolicy: Always
          command: [ "/app/init-agent" ]
          args: [ "" ]
          volumeMounts:
            - name: sw-agent
              mountPath: /opt/skywalking
      volumes:
        - name: sw-agent
          emptyDir: { }
      containers:
        - name: [镜像名]
          image: [ip]:[port]/[镜像名]:latest
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 8080
          volumeMounts:
            - name: sw-agent
              mountPath: /opt/skywalking
          #容器运行前需设置的环境变量列表
          env:
            - name: JAVA_TOOL_OPTIONS
              value: -javaagent:/opt/skywalking/agent/skywalking-agent.jar
            - name: SW_AGENT_NAME
              value: [服务名]
            - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
              value: skywalking-svc.default:11800
            - name: SPRING_PROFILES_ACTIVE
              value: qa
            - name: aliyun_logs_[]
              value: stdout
          # 资源限制:keep request = limit to keep this container in guaranteed class
          #resources:
          #  requests:
          #    cpu: 100m
          #    memory: 400Mi
          #  limits:
          #    cpu: 1000m
          #    memory: 2G

集成skywalking版,如果不需要,移除相关即可

posted @ 2023-02-27 18:13  余额一个亿  阅读(96)  评论(0编辑  收藏  举报