Setup a Kubernetes Cluster
In this module, you set up a Kubernetes cluster that has Istio installed and anamespace to use throughout the tutorial.
If you are in a workshop and the instructors provide a cluster for you,proceed to setting up your local computer.
Ensure you have access to a .You can use the Google Kubernetes Engine or the.
- Create the namespace:
$ kubectl create namespace $NAMESPACE
If you are an instructor, you should allocate a separate namespace per eachparticipant. The tutorial supports work in multiple namespacessimultaneously by multiple participants.
Install Istio with strict mutual TLS enabled. TODO: add command or point to instructions.
- Create a role to provide read access to the
istio-system
namespace. Thisrole is required to limit permissions of the participants in the stepsbelow.
$ kubectl apply -f - <<EOF
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: istio-system-access
namespace: istio-system
rules:
- apiGroups: ["", "extensions", "apps"]
resources: ["*"]
EOF
- Create a service account for each participant:
- Limit each participant’s permissions. During the tutorial, participants onlyneed to create resources in their namespace and to read resources from
istio-system
namespace. It is a good practice, even if using your owncluster, to avoid interfering with other namespaces inyour cluster.
Create a role to allow read-write access to each participant’s namespace.Bind the participant’s service account to this role and to the role forreading resources from istio-system
:
$ kubectl apply -f - <<EOF
kind: Role
metadata:
name: ${NAMESPACE}-access
namespace: $NAMESPACE
rules:
- apiGroups: ["", "extensions", "apps", "networking.k8s.io", "networking.istio.io", "authentication.istio.io",
"rbac.istio.io", "config.istio.io"]
resources: ["*"]
verbs: ["*"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ${NAMESPACE}-access
namespace: $NAMESPACE
subjects:
name: ${NAMESPACE}-user
namespace: $NAMESPACE
roleRef:
kind: Role
name: ${NAMESPACE}-access
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ${NAMESPACE}-istio-system-access
namespace: istio-system
subjects:
- kind: ServiceAccount
name: ${NAMESPACE}-user
namespace: $NAMESPACE
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: istio-system-access
EOF
Generate a Kubernetes configuration file for each participant:
- If you are setting up the cluster for yourself, copy the
${NAMESPACE}-user-config.yaml
file mentioned in the previous steps to yourlocal computer, where is the name of the namespace youprovided in the previous steps. For example,tutorial-user-config.yaml
.You will need this file later in the tutorial.
If you are an instructor, send the generated configuration files to eachparticipant who should copy it to their local computer.
You are ready to .