<p>While deploying Apache Ignite on Kubernetes I am getting following error in logs of the apache ignite pods</p>
<pre><code>Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://kubernetes.default.svc.cluster.local:443/api/v1/namespaces/ignite-stack/endpoints/ignite-service
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
    at org.apache.ignite.internal.kubernetes.connection.KubernetesServiceAddressResolver.getServiceAddresses(KubernetesServiceAddressResolver.java:109)
    ... 21 more
</code></pre>

Gursewak Singh
<p>These kind of error :</p>
<p><code>Server returned HTTP response code: 403 for URL:https://kubernetes.default.svc.cluster.local:443</code></p>
<p>usally happens when serviceaccount, secret token for service account, and clusterrolebinding is not in sync (means there is some discrepancy either in token not to service account, or they are totally in different namespaces). Therefore, apiServer cant validate the request as authentic request and gives 403 error.</p>
<p>In my case, service account was having wrong namespace as shown below:
<a href="https://i.stack.imgur.com/hkCSK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hkCSK.png" alt="enter image description here" /></a></p>
<p>Where as if you see my service account details i configured with following namespace</p>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
  creationTimestamp: &quot;2022-09-12T14:35:38Z&quot;
  name: ignite
  namespace: ignite-stack
  resourceVersion: &quot;854530&quot;
  uid: b6177528-b05c-4d10-9446-09f54164ca39
secrets:
- name: ignite-secret
</code></pre>
<p>So make sure to check these mistakes first.</p>
