diff --git a/example/config.yml b/example/config.yml index d013ecc..e6e3727 100644 --- a/example/config.yml +++ b/example/config.yml @@ -27,8 +27,11 @@ CONTEXT_NAME: "context-{{ CLUSTER_NAME }}" K8S_VER: "__k8s_ver__" # set unique 'k8s_nodename' for each node, if not set(default:'') ip add will be used +# CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.', +# and must start and end with an alphanumeric character (e.g. 'example.com'), +# regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' K8S_NODENAME: "{%- if k8s_nodename != '' -%} \ - {{ k8s_nodename }} \ + {{ k8s_nodename|replace('_', '-')|lower }} \ {%- else -%} \ {{ inventory_hostname }} \ {%- endif -%}" diff --git a/example/hosts.allinone b/example/hosts.allinone index 9713b9c..883a96c 100644 --- a/example/hosts.allinone +++ b/example/hosts.allinone @@ -3,10 +3,14 @@ 192.168.1.1 # master node(s), set unique 'k8s_nodename' for each node +# CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.', +# and must start and end with an alphanumeric character [kube_master] 192.168.1.1 k8s_nodename='' # work node(s), set unique 'k8s_nodename' for each node +# CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.', +# and must start and end with an alphanumeric character [kube_node] 192.168.1.1 k8s_nodename='' diff --git a/example/hosts.multi-node b/example/hosts.multi-node index ad13263..2876750 100644 --- a/example/hosts.multi-node +++ b/example/hosts.multi-node @@ -5,14 +5,19 @@ 192.168.1.3 # master node(s), set unique 'k8s_nodename' for each node +# CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.', +# and must start and end with an alphanumeric character [kube_master] -192.168.1.1 k8s_nodename='' -192.168.1.2 k8s_nodename='' +192.168.1.1 k8s_nodename='master-01' +192.168.1.2 k8s_nodename='master-02' +192.168.1.3 k8s_nodename='master-03' # work node(s), set unique 'k8s_nodename' for each node +# CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.', +# and must start and end with an alphanumeric character [kube_node] -192.168.1.3 k8s_nodename='' -192.168.1.4 k8s_nodename='' +192.168.1.4 k8s_nodename='worker-01' +192.168.1.5 k8s_nodename='worker-02' # [optional] harbor server, a private docker registry # 'NEW_INSTALL': 'true' to install a harbor server; 'false' to integrate with existed one