Answers: <p>Create file daemon.json in /etc/docker/
  inside put this:
  {
  &quot;insecure-registries&quot; : [&quot;docker-registry-machine-name:443&quot;,&quot;docker-registry-machine-name:80&quot;,&quot;0.0.0.0/0&quot;]
  }
  and save it.</p>
  <p>After that with jenkins user run this command:
  git config --global http.sslVerify &quot;false&quot;</p>
  <p>Then restart Jenkins and should work.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-08-29T11:07:29.123Z
Answers: 2023-08-29T11:07:29.123Z
Answers: A. Petrov
Body: <p>I am facing issue when trying to import k8s cluster in Rancher.</p>
  <p>here are the logs of when trying to run the commands:</p>
  <p>Commnad:</p>
  <pre><code>curl --insecure -sfL https://172.31.91.168/v3/import/zlxz57dj7nhpdzx4cw7lvfdnj9zt7n2tpk4df5v7frq2tfjf52j49j_c-m-jgw4wzm5.yaml | kubectl apply -f -
  </code></pre>
  <p>Logs</p>
  <pre><code>clusterrole.rbac.authorization.k8s.io/proxy-clusterrole-kubeapiserver unchanged
  
  clusterrolebinding.rbac.authorization.k8s.io/proxy-role-binding-kubernetes-master unchanged
  namespace/cattle-system unchanged
  serviceaccount/cattle unchanged
  clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding unchanged
  secret/cattle-credentials-f144527 unchanged
  clusterrole.rbac.authorization.k8s.io/cattle-admin unchanged
  deployment.apps/cattle-cluster-agent configured
  service/cattle-cluster-agent unchanged
  </code></pre>
  <p>Second Command:</p>
  <pre><code>kubectl apply -f https://172.31.91.168/v3/import/zlxz57dj7nhpdzx4cw7lvfdnj9zt7n2tpk4df5v7frq2tfjf52j49j_c-m-jgw4wzm5.yaml
  </code></pre>
  <p>Logs:</p>
  <pre><code>Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority
  </code></pre>
  <p>Unable to identify the issue. As rancher is running on separate e2 instance under Docker and K8s cluster is running separate machine and worker node as well.</p>
  <p>For reference sharing the snap shot:</p>
  <p><a href="https://i.sstatic.net/TEGyi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TEGyi.png" alt="enter image description here" /></a>
  <a href="https://i.sstatic.net/OPaab.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OPaab.png" alt="enter image description here" /></a></p>
  <p>I check out almost the number of given answer here related to SSL but not able to find and relevant answer.</p>
  
Comments: CC BY-SA 4.0
Comments: 2023-07-19T11:53:23.040Z
Comments: Can you check the api server logs or certificate paths?
Comments: Deepak Mourya
Comments: CC BY-SA 4.0
Comments: 2023-07-19T12:19:20.023Z
Comments: @DeepakMourya thanks . AS the issue has been resolved.
Comments: Abdullah Manzoor
Comments: CC BY-SA 4.0
Comments: 2023-07-19T12:20:20.093Z
Comments: There was issue with kubectl version of Rancher and K8s server. By the way we can use the first command to add import the cluster.
Comments: Abdullah Manzoor
Tags: <kubernetes><linux><ssl><rancher>
Title: Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority
UserDisplayName: Abdullah Manzoor
ThreadText: # Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority
  
  (Asked by: username_0 on 2023-07-19)
  
  I am facing issue when trying to import k8s cluster in Rancher.
  
  here are the logs of when trying to run the commands:
  
  Commnad:
  
  ```
  curl --insecure -sfL https://172.31.91.168/v3/import/zlxz57dj7nhpdzx4cw7lvfdnj9zt7n2tpk4df5v7frq2tfjf52j49j_c-m-jgw4wzm5.yaml | kubectl apply -f -
  
  ```
  
  Logs
  
  ```
  clusterrole.rbac.authorization.k8s.io/proxy-clusterrole-kubeapiserver unchanged
  
  clusterrolebinding.rbac.authorization.k8s.io/proxy-role-binding-kubernetes-master unchanged
  namespace/cattle-system unchanged
  serviceaccount/cattle unchanged
  clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding unchanged
  secret/cattle-credentials-f144527 unchanged
  clusterrole.rbac.authorization.k8s.io/cattle-admin unchanged
  deployment.apps/cattle-cluster-agent configured
  service/cattle-cluster-agent unchanged
  
  ```
  
  Second Command:
  
  ```
  kubectl apply -f https://172.31.91.168/v3/import/zlxz57dj7nhpdzx4cw7lvfdnj9zt7n2tpk4df5v7frq2tfjf52j49j_c-m-jgw4wzm5.yaml
  
  ```
  
  Logs:
  
  ```
  Unable to connect to the server: tls: failed to verify certificate: x509: certificate signed by unknown authority
  
  ```
  
  Unable to identify the issue. As rancher is running on separate e2 instance under Docker and K8s cluster is running separate machine and worker node as well.
  
  For reference sharing the snap shot:
  
  [![enter image description here](https://i.sstatic.net/TEGyi.png)](https://i.sstatic.net/TEGyi.png)
  [![enter image description here](https://i.sstatic.net/OPaab.png)](https://i.sstatic.net/OPaab.png)
  
  I check out almost the number of given answer here related to SSL but not able to find and relevant answer.
  
  **Tags:** kubernetes, linux, ssl, rancher
  
  > **Comments:**
  > **username_1**: Can you check the api server logs or certificate paths?  
  > **username_0**: @username_1 thanks . AS the issue has been resolved.  
  > **username_0**: There was issue with kubectl version of Rancher and K8s server. By the way we can use the first command to add import the cluster.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2023-08-29. Score: 0
  
  Create file daemon.json in /etc/docker/
  inside put this:
  {
  "insecure-registries" : ["docker-registry-machine-name:443","docker-registry-machine-name:80","0.0.0.0/0"]
  }
  and save it.
  
  After that with jenkins user run this command:
  git config --global http.sslVerify "false"
  
  Then restart Jenkins and should work.
  
  
  ---
  
  