To create the gke-oidc-envoy load balancer as external instead of internal, you’ll need to modify how GKE deploys the OIDC authentication components. By default, Google Cloud creates an internal load balancer for OIDC, but you can override this by modifying the service settings or manually configuring an external LoadBalancer.
- Verify the current service type, as gke-oidc-envoy is deployed as an internal LoadBalancer by default.
kubectl get service gke-oidc-envoy -n kube-system -o yaml
- To use an external load balancer for gke-oidc-envoy, update the service by removing the internal annotation and specifying an external load balancer.
- Enable internet traffic by checking if GKE has automatically created a firewall rule blocking external access and updating it as needed.
gcloud compute firewall-rules list --filter=“name:gke-oidc-*”
- Update the Firewall Rule to Allow Public Access
Modify the firewall rule to allow public access to the load balancer:
gcloud compute firewall-rules update FIREWALL_RULE_NAME --allow tcp:443 --source-ranges=0.0.0.0/0
Or, if needed, create a new rule:
gcloud compute firewall-rules create allow-external-oidc \
–network=YOUR_NETWORK_NAME \
–allow tcp:443 \
–source-ranges=0.0.0.0/0 \
–target-tags=gke-oidc-envoy
- Verify the External Load Balancer to ensure the service has an external IP after applying the changes. The assigned IP should be external rather than internal.
kubectl get svc gke-oidc-envoy -n kube-system
- Update the OIDC configuration to use the new external endpoint. If your applications were previously relying on the internal OIDC service, update their settings to use the external IP and adjust the OIDC provider configuration if needed.
export OIDC_EXTERNAL_IP=$(kubectl get svc gke-oidc-envoy -n kube-system -o jsonpath=‘{.status.loadBalancer.ingress[0].ip}’)
echo “External OIDC Load Balancer IP: $OIDC_EXTERNAL_IP”
To expose gke-oidc-envoy externally, remove the internal load balancer annotation, set the service type to LoadBalancer, and ensure firewall rules allow public access.
If you need further assistance, you can reach out to Google Cloud Support at any time.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.