Files
myk3sTest/.deploy/deployment.yml
bamanker 52b8ebf954 2
2025-12-24 12:29:53 +08:00

80 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
## k8s默认是访问不了外部服务的需要代理,以mysql和redis为例代理myservice名称到192.168.0.100配置文件中对应的ip修改为myservice
#apiVersion: v1
#kind: Endpoints
#metadata:
# name: myservice
#subsets:
# - addresses:
# - ip: 192.168.0.100
# ports:
# - port: 6379
# protocol: TCP
# name: redis
# - port: 3306
# protocol: TCP
# name: mysql
#---
#apiVersion: v1
#kind: Service
#metadata:
# name: myservice
#spec:
# ports:
# - port: 6379
# targetPort: 6379
# protocol: TCP
# name: redis
# - port: 3306
# targetPort: 3306
# protocol: TCP
# name: mysql
#
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: myk3sTest
spec:
replicas: 2
revisionHistoryLimit: 3
selector:
matchLabels:
app: myk3sTest
template:
metadata:
labels:
app: myk3sTest
spec:
containers:
- image: ${env.REGISTRY}/${env.IMAGE_NAME}:${steps.datetime.outputs.datetime}
name: myk3sTest
imagePullPolicy: Always
readinessProbe:
httpGet:
path: /actuator/health
port: 9090
initialDelaySeconds: 1
successThreshold: 5
ports:
- containerPort: 9090
imagePullSecrets:
- name: dockerhub-id
---
apiVersion: v1
kind: Service
metadata:
name: myk3sTest
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: http-8080
protocol: TCP
port: 9090
nodePort: 30099
selector:
app: myk3sTest