94 lines
2.8 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: iot-gateway
name: iot-gateway
namespace: qiuguo-iot #一定要写名称空间
spec:
progressDeadlineSeconds: 600
replicas: 1
selector:
matchLabels:
app: iot-gateway
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
type: RollingUpdate
template:
metadata:
labels:
app: iot-gateway
spec:
initContainers:
- name: agent-container
image: apache/skywalking-java-agent:9.0.0-java8
volumeMounts:
- name: skywalking-agent
mountPath: /agent
command: [ "/bin/sh" ]
args: [ "-c", "cp /skywalking/agent/optional-plugins/apm-nacos-client-2.x-plugin-9.0.0.jar /skywalking/agent/plugins/\n
cp /skywalking/agent/optional-plugins/apm-spring-cloud-gateway-3.x-plugin-9.0.0.jar /skywalking/agent/plugins/\n
cp /skywalking/agent/optional-plugins/apm-spring-webflux-5.x-plugin-9.0.0.jar /skywalking/agent/plugins/ \n
cp -R /skywalking/agent /agent/" ]
imagePullSecrets:
- name: aliyun-hub-register #提前在项目下配置访问阿里云的账号密码
containers:
- image: $REGISTRY/$DOCKERHUB_NAMESPACE/qiuguo-iot:iot-gateway-SNAPSHOT-v$BUILD_NUMBER
env:
- name: JAVA_TOOL_OPTIONS
value: "-javaagent:/skywalking/agent/skywalking-agent.jar"
- name: SW_AGENT_NAME
value: "iot-gateway"
- name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
value: "skywalking-oap.skywalking:11800"
readinessProbe:
httpGet:
path: /actuator/health
port: 8080
timeoutSeconds: 10
failureThreshold: 30
periodSeconds: 5
imagePullPolicy: Always
name: app
ports:
- containerPort: 8080
protocol: TCP
volumeMounts:
- mountPath: /home/qiuguo/logs
name: iot-logs
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /nfs/data/qiuguo/iot/logs
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
volumes:
- name: iot-logs
hostPath:
path: /nfs/data/qiuguo/iot/logs
- name: host-time
hostPath:
path: /etc/localtime
---
apiVersion: v1
kind: Service
metadata:
labels:
app: iot-gateway
name: iot-gateway
namespace: qiuguo-iot
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: iot-gateway
sessionAffinity: None
type: ClusterIP