<p>I am trying to connect to kubernetes cluster using master url. However, I encounter an error when attempting the following command</p>

<p>Command: <code>config, ConfigErr clientcmd.BuildConfigFromFlags("https://192.168.99.100:8443","")</code> </p>

<p>Error: <code>Get "https://192.168.99.100:8443/api/v1/namespaces": x509: certificate signed by unknown authority</code></p>

<p>Has anyone else encountered this and/or know how to solve this error?</p>

Pattapu Sai
<p>Get the kube-apiserver endpoint by describing the service</p>

<pre><code>kubectl describe svc kubernetes
</code></pre>

<p>This will list the endpoint for your APIServer like this:</p>

<pre><code>Endpoints:         172.17.0.6:6443
</code></pre>

<p>Get the token to access the APIServer like this:</p>

<pre><code>TOKEN=$(kubectl get secret $(kubectl get serviceaccount default -o jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | base64 --decode )
</code></pre>

<p>Query the APIServer with the retreived token:</p>

<pre><code>curl -v https://172.17.0.6:6443/api/v1/nodes -k  --header "Authorization:Bearer $TOKEN" --insecure
</code></pre>
