apiVersion: v1
kind: ConfigMap
metadata:
name: zeze-test-env
data:
APP_PORT: "8888"
APP_URL: "www.linuxhub.cn"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: zeze-test
spec:
replicas: 1
selector:
matchLabels:
app: zeze-test
template:
metadata:
labels:
app: zeze-test
spec:
containers:
- name: nignx
image: linuxhub/nginx:1.15.5
ports:
- containerPort: 80
envFrom:
- configMapRef:
name: zeze-test-env
$ kubectl get pod -l app=zeze-test
NAME READY STATUS RESTARTS AGE
zeze-test-6fbb8d5985-mldd8 1/1 Running 0 99s
$ kubectl exec -it zeze-test-6fbb8d5985-mldd8 bash
root@zeze-test-6fbb8d5985-mldd8:/# echo $APP_PORT
8888
root@zeze-test-6fbb8d5985-mldd8:/# echo $APP_URL
www.linuxhub.cn
网友评论