Kubernetes
Gremlin allows targeting objects within your Kubernetes clusters. After selecting a cluster, you can filter the visible set of objects by selecting a namespace. Select any of your Deployments
, ReplicaSets
, StatefulSets
, DaemonSets
, or Pods
. When one object is selected, all child objects will also be targeted. For example, when selecting a DaemonSet, all of the pods within will be selected.
Only parent Kubernetes objects are available to target. Pods will be listed only if they don't belong to a Set or Deployment.
Installation
In addition to the Gremlin client that is installed on the host, or node, of a Kubernetes cluster, you must also install the Gremlin Kubernetes client to the cluster. The Kubernetes client can be installed either using kubectl
or helm
. Both methods are outlined here.
Create a Kubernetes secret from Gremlin certificates
- Download the Gremlin certificates (you need at least team manager access)
- Unzip certificates.zip
- Rename the files in the certificates folder.
Team Name.pub_cert.pem
becomesgremlin.cert
.Team Name.priv_key.pem
becomesgremlin.key
. - Create a gremlin namespace:
kubectl create namespace gremlin
- Create a kubernetes secret by running the following:
kubectl -n gremlin create secret generic gremlin-team-cert --from-file=/path/to/gremlin.cert --from-file=/path/to/gremlin.key
kubectl
Download and apply the Gremlin client manifest
- Download the gremlin client manifest for your kubernetes cluster by running the following:
wget https://k8s.gremlin.com/resources/gremlin-client.yaml
- Open the file and update
GREMLIN_TEAM_ID
with your team ID - Apply the manifest with this command:
kubectl apply -f /path/to/gremlin-client.yaml
Download and apply the K8s client manifest
- Download the k8s client manifest by running:
wget https://k8s.gremlin.com/resources/chao.yaml
- Replace the following line with your team ID: "YOUR TEAM ID GOES HERE"
- Replace the following line with a string that you will use to identify your cluster: "YOUR UNIQUE CLUSTER NAME GOES HERE"
- Apply the manifest with the following command:
kubectl apply -f /path/to/chao.yaml
Helm
Let Gremlin know your Gremlin team ID and your Kubernetes cluster name
GREMLIN_TEAM_ID="changeit"
GREMLIN_CLUSTER_ID="changeit"
Add the Gremlin beta helm chart
helm repo remove gremlin
helm repo add gremlin https://helm.gremlin.com/beta
Create a namespace for the Gremlin Kubernetes client
kubectl create namespace gremlin
Pass your certificate to both the Gremlin and Kubernetes client
kubectl create secret generic gremlin-team-cert \
--namespace=gremlin \
--from-file=/path/to/gremlin.cert \
--from-file=/path/to/gremlin.key
Install the Gremlin Kubernetes client
helm install \
--namespace gremlin \
--name gremlin \
--devel gremlin/gremlin \
--set gremlin.teamID=$GREMLIN_TEAM_ID \
--set gremlin.clusterID=$GREMLIN_CLUSTER_ID
Running an attack
Once you select the Kubernetes objects to be targeted, select and configure your desired Gremlin attack. When the attack in run, the underlying containers within the objects selected will be impacted.
Containers share resources with their hosts. Running resource attacks on Kubernetes objects will impact the hosts where the targeted containers are running, including the host's full set of containers.