Securing Endpoints
In enterprise use cases, you may need to control who can access the endpoints for deployed models or pipelines. You can leverage existing authentication mechanisms in your cluster or environment, such as service mesh-level controls, or use cloud provider solutions like Apigee on GCP, Amazon API Gateway on AWS, or a provider-agnostic gateway like Gravitee. Seldon Core 2 integrates with various service meshes that support these requirements. Though Seldon Core 2 is service-mesh agnostic, the example on this page demonstrates how to set up authentication and authorization to secure a model endpoint using the Istio service mesh.
Securing Endpoints with Istio
Service meshes offer a flexible way of defining authentication and authorization rules for your models. With Istio, for example, you can configure multiple layers of security within an Istio Gateway, such as a TLS for HTTPS at the gateway level, mutual TLS (mTLS) for secure internal communication, as well as AuthorizationPolicies and RequestAuthentication policies to enforce both authentication and authorization controls.
Prerequisites
Configure a OIDC provider to authenticate. Obtain the
issuer
url,jwksUri
, and theAccess token
from the OIDC provider.
Note There are many types of authorization policies that you can configure to enable access control on workloads in the mesh.
In the following example, you can secure the endpoint such that any requests to the endpoint without the access token are denied.
To secure the endpoints of a model, you need to:
Create a
RequestAuthentication
resource namedingress-jwt-auth
in theistio-system namespace
. Replace<OIDC_TOKEN_ISSUER>
and<OIDC_TOKEN_ISSUER_JWKS>
with your OIDC provider’s specific issuer URL and JWKS (JSON Web Key Set) URI.
Create the resource using kubectl apply -f ingress-jwt-auth.yaml
.
Create an authorization policy
deny-empty-jwt
in the namespaceistio-system
.
Create the resource using kubectl apply -f deny-empty-jwt.yaml
.
To verify that the requests without an access token are denied send this request:
The output is similar to:
Now, send the same request with an access token:
The output is similar to:
Last updated
Was this helpful?