main
黄海 10 months ago
parent f100020862
commit 0abc964586

@ -0,0 +1,73 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations: {}
labels:
app: nginx-deployment-label
name: nginx-deployment
namespace: default
resourceVersion: '568978'
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: nginx-selector
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: nginx-selector
spec:
containers:
- env:
- name: password
value: '123'
- name: age
value: '18'
image: >-
swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openresty/openresty:1.25.3.1-5-alpine-fat
imagePullPolicy: Always
name: nginx-container
ports:
- containerPort: 80
name: http
protocol: TCP
- containerPort: 443
name: https
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 1
conditions:
- lastTransitionTime: '2024-09-14T12:15:22Z'
lastUpdateTime: '2024-09-14T12:15:22Z'
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: 'True'
type: Available
- lastTransitionTime: '2024-09-14T12:15:20Z'
lastUpdateTime: '2024-09-14T12:15:22Z'
message: ReplicaSet "nginx-deployment-86b7dc4856" has successfully progressed.
reason: NewReplicaSetAvailable
status: 'True'
type: Progressing
observedGeneration: 1
readyReplicas: 1
replicas: 1
updatedReplicas: 1

@ -0,0 +1,36 @@
---
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx-service-label
name: nginx-service
namespace: default
resourceVersion: '569157'
spec:
clusterIP: 10.97.26.42
clusterIPs:
- 10.97.26.42
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: http
nodePort: 30004
port: 80
protocol: TCP
targetPort: 80
- name: https
nodePort: 30443
port: 443
protocol: TCP
targetPort: 443
selector:
app: nginx-selector
sessionAffinity: None
type: NodePort
status:
loadBalancer: {}

@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: openresty-deployment
spec:
replicas: 2 # 根据需求设置副本数量
selector:
matchLabels:
app: openresty
template:
metadata:
labels:
app: openresty
spec:
containers:
- name: openresty
image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openresty/openresty:1.25.3.1-5-alpine-fat
ports:
- containerPort: 80
name: http
- containerPort: 443
name: https
volumeMounts:
- mountPath: /usr/local/openresty/nginx/conf/lua-scripts
name: lua-scripts-volume
command: ["/bin/bash", "-c"]
args: ["exec /usr/bin/openresty -g 'daemon off;'"]
volumes:
- name: lua-scripts-volume
configMap:
name: openresty-lua-configmap

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: openresty-service
spec:
selector:
app: openresty
ports:
- name: http
port: 80
targetPort: 80
- name: https
port: 443
targetPort: 443
type: LoadBalancer # 或者 NodePort

@ -0,0 +1,5 @@
# Deployment
kubectl apply -f deployment.yaml
#Export Service
kubectl apply -f service.yaml
Loading…
Cancel
Save