修改docker的service配置,增加环境变量
parent
d934d7ead1
commit
4abc752bcf
|
@ -41,7 +41,10 @@ Before=docker.service
|
|||
Type=notify
|
||||
EnvironmentFile=/etc/sysconfig/flanneld
|
||||
EnvironmentFile=-/etc/sysconfig/docker-network
|
||||
ExecStart=/usr/bin/flanneld-start $FLANNEL_OPTIONS
|
||||
ExecStart=/usr/bin/flanneld-start \
|
||||
-etcd-endpoints=${ETCD_ENDPOINTS} \
|
||||
-etcd-prefix=${ETCD_PREFIX} \
|
||||
FLANNEL_OPTIONS
|
||||
ExecStartPost=/usr/libexec/flannel/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker
|
||||
Restart=on-failure
|
||||
|
||||
|
@ -56,11 +59,11 @@ RequiredBy=docker.service
|
|||
# Flanneld configuration options
|
||||
|
||||
# etcd url location. Point this to the server where etcd runs
|
||||
FLANNEL_ETCD_ENDPOINTS="https://172.20.0.113:2379,https://172.20.0.114:2379,https://172.20.0.115:2379"
|
||||
ETCD_ENDPOINTS="https://172.20.0.113:2379,https://172.20.0.114:2379,https://172.20.0.115:2379"
|
||||
|
||||
# etcd config key. This is the configuration key that flannel queries
|
||||
# For address range assignment
|
||||
FLANNEL_ETCD_PREFIX="/kube-centos/network"
|
||||
ETCD_PREFIX="/kube-centos/network"
|
||||
|
||||
# Any additional options that you want to pass
|
||||
FLANNEL_OPTIONS="-etcd-cafile=/etc/kubernetes/ssl/ca.pem -etcd-certfile=/etc/kubernetes/ssl/kubernetes.pem -etcd-keyfile=/etc/kubernetes/ssl/kubernetes-key.pem"
|
||||
|
@ -85,6 +88,8 @@ etcdctl --endpoints=https://172.20.0.113:2379,https://172.20.0.114:2379,https://
|
|||
mk /kube-centos/network/config "{"Network":"172.30.0.0/16","SubnetLen":24,"Backend":{"Type":"vxlan"}}"
|
||||
```
|
||||
|
||||
如果你要使用`host-gw`模式,可以直接将vxlan改成`host-gw`即可。
|
||||
|
||||
**配置Docker**
|
||||
|
||||
Flannel的[文档](https://github.com/coreos/flannel/blob/master/Documentation/running.md)中有写**Docker Integration**:
|
||||
|
|
|
@ -11,20 +11,15 @@ NotifyAccess=all
|
|||
EnvironmentFile=-/etc/sysconfig/docker
|
||||
EnvironmentFile=-/etc/sysconfig/docker-storage
|
||||
EnvironmentFile=-/etc/sysconfig/docker-network
|
||||
EnvironmentFile=-/run/docker_opts.env
|
||||
Environment=GOTRACEBACK=crash
|
||||
Environment=DOCKER_HTTP_HOST_COMPAT=1
|
||||
Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
|
||||
ExecStart=/usr/bin/dockerd-current \
|
||||
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
|
||||
--default-runtime=docker-runc \
|
||||
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
|
||||
ExecStart=/usr/bin/dockerd \
|
||||
--exec-opt native.cgroupdriver=systemd \
|
||||
$OPTIONS \
|
||||
$DOCKER_STORAGE_OPTIONS \
|
||||
$DOCKER_NETWORK_OPTIONS \
|
||||
$ADD_REGISTRY \
|
||||
$BLOCK_REGISTRY \
|
||||
$INSECURE_REGISTRY \
|
||||
$DOCKER_OPT_BIP \
|
||||
$DOCKER_OPT_IPMASQ \
|
||||
$DOCKER_OPT_MTU \
|
||||
-s=overlay \
|
||||
--log-driver=json-file \
|
||||
--insecure-registry=sz-pg-oam-docker-hub-001.tendcloud.com
|
||||
|
|
Loading…
Reference in New Issue