apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: etcd
name: etcd
namespace: moonfdd
spec:
replicas: 1
selector:
matchLabels:
app: etcd
template:
metadata:
labels:
app: etcd
spec:
containers:
- env:
- name: "ETCD_ROOT_PASSWORD"
value: "moonfdd"
- name: "ETCD_ADVERTISE_CLIENT_URLS"
value: "http://0.0.0.0:2379"
- name: "ETCD_LISTEN_PEER_URLS"
value: "http://0.0.0.0:2380"
- name: "ETCD_INITIAL_ADVERTISE_PEER_URLS"
value: "http://0.0.0.0:2380"
- name: "ETCD_INITIAL_CLUSTER"
value: "moonfdd=http://0.0.0.0:2380"
- name: "ETCD_NAME"
value: "moonfdd"
- name: "ETCD_DATA_DIR"
value: "/opt/bitnami/etcd/data"
image: bitnami/etcd
securityContext:
privileged: true
imagePullPolicy: IfNotPresent
name: etcd
volumeMounts:
- mountPath: /opt/bitnami/etcd/data
name: volv2
volumes:
- hostPath:
path: /root/k8s/moonfdd/etcd/opt/bitnami/etcd/data
type: DirectoryOrCreate
name: volv2
---
apiVersion: v1
kind: Service
metadata:
labels:
app: etcd
name: etcd
namespace: moonfdd
spec:
ports:
- port: 2379
protocol: TCP
targetPort: 2379
name: 2379-2379
- port: 2380
protocol: TCP
targetPort: 2380
name: 2380-2380
selector:
app: etcd
type: NodePort
评论