Simplify the Linkerd Authorization Policies management according to the article by giving a bunch of predefined policies and opinionated structures.
Special checkers to find obsolete resources and misconfigurations, plus ultra-fast authz
command implementation (up to 10x faster than original one).
Linkerd Version | EasyAuth Version |
---|---|
2.11.x | 0.1.0 - 0.4.0 |
2.12.x | >= 0.5.0 |
2.13.x | >= 0.5.0 |
2.14.x | >= 0.5.0 |
New AuthorizationPolicy
is supported since 0.6.0
. New HTTPRoute
is supported since 0.8.0
Grab latest binaries from the releases page: https://github.com/aatarasoff/linkerd-easyauth/releases.
linkerd easyauth [COMMAND] -n <namespace> [FLAGS]
authcheck
: checks for obsoleteServer
and policies resources likeServerAuthorization
,AuthorizationPolicy
,MeshTLSAuthentication
,NetworkAuthentication
, andHTTPRoute
, checks that PODs ports haveServer
resourcelist
: list of Pods that were injected bylinkerd.io/easyauth-enabled: true
annotation (more information below)authz
: fast implementation for fetch the list authorization policies for a resource (use caching)
Install the helm chart with injector and policies:
> kubectl create ns linkerd-easyauth
# Edit namespace and add standard linkerd annotations
> helm repo add linkerd-easyauth https://aatarasoff.github.io/linkerd-easyauth
> helm install -n linkerd-easyauth linkerd-easyauth linkerd-easyauth/linkerd-easyauth --values your_values.yml
- Injector that adds
linkerd.io/easyauth-enabled: true
label for all meshed pods (you can limit namespaces via helmchart) Server
in terms of Linkerd authorization policies forlinkerd-admin-port
AuthorizationPolicy
resources that provides basic allow policies for ingress, Linkerd itself, and monitoring
Because the Server
should be one per service per port, we can define the server for the linkerd proxy admin port only.
For each port that should be used by other pods, or Linkerd you should add the server definition manually:
---
apiVersion: policy.linkerd.io/v1beta1
kind: Server
metadata:
namespace: <app-namespace>
name: <app-server-name>
labels:
linkerd.io/server-type: common
spec:
podSelector:
matchLabels:
<app-label>: <app-unique-value>
port: <my-port-name>
Because all AuthorizationPolicy
policies are Namespaced scope then we should add common policies to each namespace with our apps:
meshedApps:
namespaces:
- hippos
- elephants
In case of using route-based policy you should authorize requests for passing probes by adding app-specific HTTPRoute
and policies for it for each app:
apiVersion: policy.linkerd.io/v1alpha1
kind: AuthorizationPolicy
metadata:
name: cool-app-health-check-allow
namespace: cool-ns
spec:
targetRef:
group: policy.linkerd.io
kind: HTTPRoute
name: cool-app-health-check
requiredAuthenticationRefs:
- name: cluster-network-authn
kind: NetworkAuthentication
group: policy.linkerd.io
The Helm chart generates NetworkAuthentication with name cluster-network-authn
to authorize cluster network requests.
You should explicitly provide cluster network or authorize kubelet only. It depends on the K8s implementation you are using and could be setup via clusterNetwork
section in the values.
⚠ WARNING: 2.11.x only
Because of the issue, in 2.11.x version of Linkerd you should explicitly provide CIDR for kubelet. It depends on the K8s implementation you are using.
There are two possibility. If you can define CIDR precisely then you can use it
kubelet:
cidr:
- cidr: 10.164.0.0/20
If you cannot do it, but you have GKE-like pattern then you can define octets and ranges for generation the bunch of /32
CIDR:
kubelet:
cidr: []
# generate by pattern octet0:{low1-high1}:{low2-high2}:octet3 (10.169.150.1)
generator:
octet0: 10
low1: 168
high1: 172
low2: 0
high2: 256
octet3: 1