By default, Kubernetes services with type ClusterIP
are accessible from the same cluster. Is there a way to configure a service in GKE to be accessible from the same VPC? e.g., a GCE VM in the same VPC could access the service in GKE, but I don't want to expose it to the internet.
This is not possible. The official GKE documentation on VPC-native clusters says:
Cluster IPs for internal Services are available only from within the cluster. If you want to access a Kubernetes Service from within the VPC, but from outside of the cluster (for example, from a Compute Engine instance), use an internal load balancer.
See here.
You can use a NodePort service and some firewall rules, otherwise probably not. In the abstract it is possible, you can bridge your other VMs into the same overlay network that Kubernetes uses, but I don't think it's doable with GKE, they don't give you the low-level control you would need.