diff --git a/roles/kubernetes/kubeadm/tasks/main.yml b/roles/kubernetes/kubeadm/tasks/main.yml
index 7c967569f7049cb39fe2648fee359f0661ca35d1..171bf87102e684ba4954bd5740128d295c34936d 100644
--- a/roles/kubernetes/kubeadm/tasks/main.yml
+++ b/roles/kubernetes/kubeadm/tasks/main.yml
@@ -5,7 +5,7 @@
       {%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
       {{ first_kube_master }}:{{ kube_apiserver_port }}
       {%- else -%}
-      {{ kube_apiserver_endpoint }}
+      {{ kube_apiserver_endpoint | replace("https://", "") }}
       {%- endif %}
   tags:
     - facts
@@ -119,7 +119,7 @@
   when:
     - kubeadm_config_api_fqdn is not defined
     - not is_kube_master
-    - kubeadm_discovery_address != kube_apiserver_endpoint
+    - kubeadm_discovery_address != kube_apiserver_endpoint | replace("https://", "")
   notify: restart kubelet
 
 - name: Update server field in kube-proxy kubeconfig
@@ -131,7 +131,7 @@
   when:
     - inventory_hostname == groups['kube-master']|first
     - kubeadm_config_api_fqdn is not defined
-    - kubeadm_discovery_address != kube_apiserver_endpoint
+    - kubeadm_discovery_address != kube_apiserver_endpoint | replace("https://", "")
     - not kube_proxy_remove
   tags:
     - kube-proxy
@@ -142,7 +142,7 @@
   when:
     - inventory_hostname == groups['kube-master']|first
     - kubeadm_config_api_fqdn is not defined
-    - kubeadm_discovery_address != kube_apiserver_endpoint
+    - kubeadm_discovery_address != kube_apiserver_endpoint | replace("https://", "")
     - not kube_proxy_remove
   tags:
     - kube-proxy
@@ -166,7 +166,7 @@
   when:
     - inventory_hostname == groups['kube-master']|first
     - kube_proxy_remove
-    - kubeadm_discovery_address != kube_apiserver_endpoint
+    - kubeadm_discovery_address != kube_apiserver_endpoint | replace("https://", "")
   tags:
     - kube-proxy
 
diff --git a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2 b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2
index c76d28b788479c54f53071464eda5ad67bcac307..54e875cb1ab8c8fa8adf9bc730719315ca314149 100644
--- a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2
+++ b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2
@@ -6,7 +6,7 @@ discoveryTokenAPIServers:
 {% if kubeadm_config_api_fqdn is defined %}
 - {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
 {% else %}
-- {{ kubeadm_discovery_address | replace("https://", "")}}
+- {{ kubeadm_discovery_address }}
 {% endif %}
 discoveryTokenCACertHashes:
 - sha256:{{ kubeadm_ca_hash.stdout }}
diff --git a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2 b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2
index 3c613ec7de63b89343cc3b8b29260bde45887869..38d4733c764bfdf4d8fff665b144f319a3af7832 100644
--- a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2
+++ b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2
@@ -11,7 +11,7 @@ discoveryTokenAPIServers:
 {% if kubeadm_config_api_fqdn is defined %}
 - {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
 {% else %}
-- {{ kubeadm_discovery_address | replace("https://", "")}}
+- {{ kubeadm_discovery_address }}
 {% endif %}
 discoveryTokenUnsafeSkipCAVerification: true
 nodeRegistration:
diff --git a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha3.j2 b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha3.j2
index 18c3f146aa80645e48ea5f554a276aa914b9f7da..46e365a831e480adafb835467f07b24548d1d1db 100644
--- a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha3.j2
+++ b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha3.j2
@@ -11,7 +11,7 @@ discoveryTokenAPIServers:
 {% if kubeadm_config_api_fqdn is defined %}
 - {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
 {% else %}
-- {{ kubeadm_discovery_address | replace("https://", "")}}
+- {{ kubeadm_discovery_address }}
 {% endif %}
 discoveryTokenUnsafeSkipCAVerification: true
 nodeRegistration:
diff --git a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta1.j2 b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta1.j2
index 1f0f9d8478e2a4867de2999e4c097c2adea32d7e..d03c9c7aff41d47507c02362a13b440aa5ce3015 100644
--- a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta1.j2
+++ b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta1.j2
@@ -6,7 +6,7 @@ discovery:
 {% if kubeadm_config_api_fqdn is defined %}
     apiServerEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
 {% else %}
-    apiServerEndpoint: {{ kubeadm_discovery_address | replace("https://", "")}}
+    apiServerEndpoint: {{ kubeadm_discovery_address }}
 {% endif %}
     token: {{ kubeadm_token }}
     caCertHashes:
diff --git a/roles/kubernetes/master/templates/kubeadm-controlplane.v1beta1.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-controlplane.v1beta1.yaml.j2
index 6442eab661065a065aae1b8a5e4a3d67d744bfa7..31c054c8f6f7d32f66895fd38330fd2e7d231c0b 100644
--- a/roles/kubernetes/master/templates/kubeadm-controlplane.v1beta1.yaml.j2
+++ b/roles/kubernetes/master/templates/kubeadm-controlplane.v1beta1.yaml.j2
@@ -5,7 +5,7 @@ discovery:
 {% if kubeadm_config_api_fqdn is defined %}
     apiServerEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
 {% else %}
-    apiServerEndpoint: {{ kubeadm_discovery_address | replace("https://", "")}}
+    apiServerEndpoint: {{ kubeadm_discovery_address }}
 {% endif %}
     token: {{ kubeadm_token }}
     unsafeSkipCAVerification: true