- Shows you how to use Istio 1.4 on Kubernetes 1.14+ with a modicum of runtime security for your workloads.
- Specifically it installs Istio with CNI support, and allows the use of restrictive PodSecurityPolicies for your workloads.
- It is designed for VMware PKS, but doesn't require it ... (just change the CNI bin dir and excluded namespaces in
values-cni.yml
, also swap the ClusterRolepks-privileged
andpks-restricted
mentioned throughout these files with your own PSP roles). - It doesn't fix the need for Istio itself to run as root, but that should be fixed in a future Istio release as it's already fixed in trunk.
- You are logged into your cluster as a cluster admin, K8s 1.14 at least
- You have the HELM CLI installed and Kustomize 3.x installed
- https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv3.4.0
- https://github.com/helm/helm/releases/tag/v2.16.0
- This should work with HELM v3 but this isn't tested
- Create a working directory
-
Add the Istio Helm Repo:
helm repo add istio.io https://storage.googleapis.com/istio-release/releases/1.4.0/charts/
-
Copy the
values-*.yml
in this GIST to your working directory. -
Make a sub-working directory
mkdir -p istio-kustomize/base
-
Copy
kustomize.yaml
,psp.yml
andsidcar-injector-configmap.yml
from this GIST into./istio-kustomize
-
Fetch/generate your Istio YAMLs
helm fetch istio.io/istio helm fetch istio.io/istio-init helm fetch istio.io/istio-cni helm template ./istio-1.4.0.tgz -f values-istio.yml --namespace istio-system > istio-kustomize/base/istio-1.4.0.yml helm template ./istio-init-1.4.0.tgz --namespace istio-system > istio-kustomize/base/istio-init-1.4.0.yml helm template ./istio-cni-1.4.0.tgz -f values-cni.yml --namespace kube-system > isito-kustomize/base/istio-cni-1.4.0.yml
-
Install Istio CNI
kubectl apply -f ./istio-kustomize/base/istio-cni-1.4.0.yml # watch for the DS and pods to come up kubectl describe ds istio-cni -n kube-system kubectl get pod -n kube-system
-
Run Kustomize to generate your Istio install
kustomize build ./istio-kustomize > istio-full.yml
-
Install istio
kubectl apply -f istio-full.yml
- Sidecar will run non-privileged due to Istio CNI
- Pod will match PSP because the securityContext of the istio-proxy sidecar should match the PSP's clauses
-
Insert pks-privileged PSP into all generated roles for istio-system pods.
PSPs are supported for istio-cni's helm chart but not yet for istio's main helm chart. -
Swap out the SidecarInjector ConfigMap helm template w/ a modified one to insert more of possible default securityContext values in the sidecar istio-proxy. See the sidecar injector diff for specifics, see for istio/istio#17427 explanation
-
Ensure the AppArmor annotations are injected appropriately (the helm chart templates this properly in Istio 1.4.0 but since I'm swapping out the results, my copy needs to also do it). See istio/istio#17334 for details
- Why does Bookinfo still require root?
Because it was built that way. Sorry. This is supposedly fixed upstream on Oct 18, but not yet pulled into the current release. See https://github.com/istio/istio/commit/53e2f40dafa7ffef3d54b9c46b831055bc9e8469 for commit, also istio/istio#14667
- Why does Istio itself require root?
Because it was built that way. Sorry. This was fixed on Oct 16 and was supposed to make Istio 1.4 but I couldn't get it to work w/ a restrictive PSP. Note that Istio itself doesn't even support PSPs with the helm chart yet (or the operator?). istio/istio#16014
- Why is any of this necessary?
A historical analogy: In the 1980's, PC software evolved quickly, with few restrictions for safety and security, thus software (and even the whole OS) crashed a lot, was hard to use, hard to integrate, and conflicted with each other ("DOS ain't done until Lotus won't run"). This insanity continued for about 20 years, and circa the rise of protected memory operating systems such as Linux, Windows 2000, FreeBSD, and MacOS X, things got better. Mainframers chuckled at us and kept maintaining their secure/scalable/performant COBOL, RPG, PL/1, ADA, and NATURAL programs to run most of the world until the mid-late 1990s when the Y2K date bug forced a rewrite.
That's the Kubernetes ecosystem in 2019. Good luck, enjoy the ride, hope you have protective gear.