| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| name: deploy-service |
| namespace: test |
| annotations: |
| kubernetes.io/change-cause: "1.0" |
| spec: |
| selector: |
| matchLabels: |
| app: deploy-service |
| replicas: 3 |
| template: |
| metadata: |
| labels: |
| app: deploy-service |
| spec: |
| |
| initContainers: |
| - image: harbor.test.com/public/sky-agent:8.8.0 |
| name: sw-agent-sidecar |
| imagePullPolicy: IfNotPresent |
| command: [ "sh" ] |
| args: ['-c','mkdir -p /skywalking/agent && cp -r /usr/skywalking/agent/* /skywalking/agent'] |
| volumeMounts: |
| - mountPath: /skywalking/agent |
| name: sw-agent |
| imagePullSecrets: |
| - name: regsecret |
| containers: |
| - name: deploy-service |
| image: deploy-image |
| imagePullPolicy: IfNotPresent |
| ports: |
| - containerPort: serverport |
| resources: |
| requests: |
| memory: "2Gi" |
| cpu: "1" |
| limits: |
| memory: "2Gi" |
| cpu: "1" |
| env: |
| - name: MY_POD_NAME |
| valueFrom: |
| fieldRef: |
| fieldPath: metadata.name |
| |
| - name: JAVA_TOOL_OPTIONS |
| value: -javaagent:/usr/skywalking/agent/skywalking-agent.jar |
| - name: SW_AGENT_NAME |
| value: dev-gateway-demo |
| - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES |
| value: 192.168.1.2:11800 |
| |
| - name: SW_AGENT_INSTANCE_NAME |
| value: dev_$(MY_POD_NAME) |
| - name: java_opts |
| value: "-Dspring.profiles.active=dev -Dspring.cloud.nacos.server-addr=nacos:8848" |
| - name: jvm_opts |
| value: "-Xms2g -Xmx2g" |
| |
| |
| livenessProbe: |
| httpGet: |
| path: /actuator/health |
| port: serverport |
| initialDelaySeconds: 150 |
| periodSeconds: 10 |
| timeoutSeconds: 5 |
| readinessProbe: |
| httpGet: |
| path: /actuator/health |
| port: serverport |
| initialDelaySeconds: 100 |
| periodSeconds: 5 |
| timeoutSeconds: 5 |
| lifecycle: |
| preStop: |
| exec: |
| command: |
| - "curl" |
| - "-XPOST" |
| - "http://127.0.0.1:serverport/actuator/shutdown" |
| volumeMounts: |
| - mountPath: /usr/skywalking/ |
| name: sw-agent |
| volumes: |
| - name: sw-agent |
| emptyDir: { } |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: deploy-service |
| namespace: test |
| |
| |
| |
| |
| labels: |
| app: deploy-service |
| spec: |
| type: ClusterIP |
| ports: |
| - port: serverport |
| targetPort: serverport |
| selector: |
| app: deploy-service |
| --- |
| |
| |
| apiVersion: networking.k8s.io/v1 |
| kind: Ingress |
| metadata: |
| name: deploy-service |
| namespace: test |
| annotations: |
| kubernetes.io/ingress.class: "nginx" |
| nginx.ingress.kubernetes.io/rewrite-target: / |
| nginx.ingress.kubernetes.io/load-balance: "ip_hash" |
| nginx.ingress.kubernetes.io/upstream-hash-by: "$request_uri" |
| spec: |
| rules: |
| - host: deploy-service.ingress.com |
| http: |
| paths: |
| - path: / |
| pathType: Prefix |
| backend: |
| service: |
| name: deploy-service |
| port: |
| number: serverport |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通