kubernetes-yaml/examples/phpmyadmin/phpmyadmin.yaml

90 lines
2.1 KiB
YAML

---
# 创建 Namespace
apiVersion: v1
kind: Namespace
metadata:
name: hty1024-db
---
# 创建 Service
apiVersion: v1
kind: Service
metadata:
name: hty1024-db-phpmyadmin-service
namespace: hty1024-db
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: db
app.k8s.hty1024.com/name: phpmyadmin
app.k8s.hty1024.com/version: 5.2.1
app.k8s.hty1024.com/resources: service
spec:
type: NodePort
ports:
- name: phpmyadmin
port: 80
targetPort: 80
nodePort: 30000
selector:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: db
app.k8s.hty1024.com/name: phpmyadmin
app.k8s.hty1024.com/version: 5.2.1
app.k8s.hty1024.com/resources: pod
---
# 创建 Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: hty1024-db-phpmyadmin
namespace: hty1024-db
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: db
app.k8s.hty1024.com/name: phpmyadmin
app.k8s.hty1024.com/version: 5.2.1
app.k8s.hty1024.com/resources: deployment
spec:
replicas: 1
minReadySeconds: 30
selector:
matchLabels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: db
app.k8s.hty1024.com/name: phpmyadmin
app.k8s.hty1024.com/version: 5.2.1
app.k8s.hty1024.com/resources: pod
template:
metadata:
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: db
app.k8s.hty1024.com/name: phpmyadmin
app.k8s.hty1024.com/version: 5.2.1
app.k8s.hty1024.com/resources: pod
spec:
terminationGracePeriodSeconds: 60
volumes:
- name: localtime
hostPath:
path: /etc/localtime
containers:
- name: phpmyadmin
image: phpmyadmin:5.2.1
ports:
- name: http
containerPort: 80
volumeMounts:
- name: localtime
mountPath: /etc/localtime
readOnly: true
env:
- name: PMA_ARBITRARY
value: "1"
nodeSelector:
node.k8s.hty1024.com/type: app