Skip to content

Latest commit

 

History

History
129 lines (97 loc) · 3.28 KB

README.md

File metadata and controls

129 lines (97 loc) · 3.28 KB

TODOS

Create a HA production ready cluster with Kubespray

Deploy the demo microservice

Setup and run Gremlin

Requirements

Create Kubespray Cluster

Note: This repo uses kubespray and this demo microservice

  1. clone the repo and cd into it

     https://github.com/kubernetes-sigs/kubespray.git
     cd kubespray 
  2. Install dependencies

    pip3 install -r requirements.txt
  3. Bring up vagrant (this can take awhile)

    vagrant up
  4. Setup access to the cluster globally

    #modify: group_vars/k8s-cluster/k8s-cluster.yml to
    kubeconfig_localhost: true
    #navigate to artifacts directory
    #/inventory/sample/artifacts
    cp admin.conf ~/.kube/config
  5. Check nodes are up

    kubectl get nodes
    
    kubectl get pods --all-namespaces

Deploy Demo Microservice

  1. Navigate to the base directory /gremlin

  2. Create a namespace for the microservice

    kubectl create namespace sock-shop
  3. Deploy it

    kubectl apply -f sock-shop.yaml
  4. Check pods are running

    kubectl get pods --namespace sock-shop
    #or
    kubectl get pods --namespace sock-shop --watch
  5. Get front-end deployment port info

    kubectl get deploy front-end -n sock-shop -o jsonpath='{.spec.template.spec.containers[?(@.name == "front-end")].ports[0].containerPort}'
    
    kubectl port-forward deploy/front-end -n sock-shop 3000:8079

Setup and run Gremlin

  1. Once logged in get the team id and secret key from the Teams page and download

  2. Install the Gremlin client with helm

     #NOTE:first change the env variables to match your team credentials
     helm repo add gremlin https://helm.gremlin.com
  3. Create a namespace for the client

    kubectl create namespace gremlin
  4. Run to install (replace credentials)

    export GREMLIN_TEAM_ID=<team-id>
    export GREMLIN_CLUSTER_ID=<cluster-di> #can be anything
    export GREMLIN_TEAM_SECRET=<team-scale>
    
    helm install gremlin gremlin/gremlin \
     --namespace gremlin \
     --set gremlin.secret.managed=true \
     --set gremlin.secret.type=secret \
     --set gremlin.secret.teamID=$GREMLIN_TEAM_ID \
     --set gremlin.secret.clusterID=$GREMLIN_CLUSTER_ID \
     --set gremlin.secret.teamSecret=$GREMLIN_TEAM_SECRET
  5. In gremlin you can check and run attacks from the intuitive dashboard

    https://app.gremlin.com/clients/hosts

    or use the API

  6. Clean up

    helm uninstall -n gremlin gremlin
    vagrant halt
    vagrant destroy -f
    kubectl config use-context docker-desktop

Resources

Official Gremlin docs