Kubernetes: Receiving Server returned HTTP response code: 403 for URL: https://kubernetes.default.svc.cluster.local:443 while deploying Ignite

Viewed 19

While deploying Apache Ignite on Kubernetes I am getting following error in logs of the apache ignite pods

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
1 Answers

These kind of error :

Server returned HTTP response code: 403 for URL:https://kubernetes.default.svc.cluster.local:443

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.

In my case, service account was having wrong namespace as shown below: enter image description here

Where as if you see my service account details i configured with following namespace

apiVersion: v1
kind: ServiceAccount
metadata:
  creationTimestamp: "2022-09-12T14:35:38Z"
  name: ignite
  namespace: ignite-stack
  resourceVersion: "854530"
  uid: b6177528-b05c-4d10-9446-09f54164ca39
secrets:
- name: ignite-secret

So make sure to check these mistakes first.

Related