This document is targeted at developers who want to use a Kubernetes environment documented in the README.md
- Requirements
- Configure kubectl
- Confirm access to K8s cluster
- Understand basic K8s/Tiller/Helm concepts
- Deploy sample Swarm
- Useful commands
aws configure
export AWS_ACCESS_KEY_ID="xxx"
export AWS_SECRET_ACCESS_KEY="xxx"
https://github.com/kubernetes-sigs/aws-iam-authenticator
Make sure you copy the aws-iam-authenticator binary in your PATH.
Ask cluster administrator to apply this to the K8S cluster.
- userarn: arn:aws:iam::123456789012:user/your-name
username: your-name
groups:
- system:masters
export NAMESPACE=your-namespace
aws eks update-kubeconfig --name your-cluster-name
# list all nodes in the cluster
kubectl get nodes
-
kubectl, kube contexts (access to multiple clusters)
-
tiller
-
helm, charts (helm applications), configurations (values.yaml)
To be able to use the Ethersphere Helm charts, you need to load them from our registry first:
helm repo add ethersphere-charts https://raw.githubusercontent.com/ethersphere/helm-charts-artifacts/master/
helm repo list
# your-values.yaml
swarm:
metricsEnabled: true
tracingEnabled: false
profilingEnabled: false
image:
repository: ethdevops/swarm
tag: latest
replicaCount: 2
config:
ens_api: http://mainnet-geth-geth.geth:8545
verbosity: 3
debug: true
maxpeers: 25
bzznetworkid: 3
bootnodes: []
secrets:
password: qwerty
persistence:
enabled: false
ingress:
domain: your-domain.com
enabled: true
tls:
acmeEnabled: true
export NAMESPACE=your-name
# Create the namespace
kubectl create namespace $NAMESPACE
# Apply tiller Role Based Access Controlls to your namespace only
kubectl -n $NAMESPACE apply -f tiller.rbac.yaml
# Start tiller in your namespace
helm init --service-account tiller --tiller-namespace $NAMESPACE
# Install sample Swarm chart
helm --tiller-namespace=$NAMESPACE \
--namespace=$NAMESPACE \
--name=swarm install ethersphere-charts/swarm \
-f your-values.yaml
# Tear-down Swarm deployment
helm del --purge swarm --tiller-namespace $NAMESPACE
# ... or remove k8s namespace altogether
kubectl delete namespace $NAMESPACE
# Upgrade sample Swarm chart
helm --tiller-namespace=$NAMESPACE \
--namespace=$NAMESPACE \
upgrade swarm ethersphere-charts/swarm \
-f your-values.yaml
# List helm applications
helm list --tiller-namespace $NAMESPACE
# list all nodes in the cluster
kubectl get nodes
# list all pods in the cluster
kubectl get pods --all-namespaces
# list all pods sorted by node
kubectl get pods -o wide --sort-by="{.spec.nodeName}" --all-namespaces
# list all namespaces
kubectl get namespaces
# attach to a given swarm container and to its javascript console
kubectl exec -n $NAMESPACE -ti swarm-0 -- sh
/geth attach /root/.ethereum/bzzd.ipc
# open Kubernetes dashboard
1. get secret
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}')
2. run proxy
kubectl proxy
3. open browser
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
# port forwarding to k8s grafana service (credentials- admin:swarm)
kubectl -n monitoring port-forward service/grafana 3000
# port forwarding to kibana service
kubectl -n logging port-forward service/efk-kibana 8443:443
# port forwarding to access pprof on a swarm pod
kubectl -n your_namespace port-forward swarm-0 6060
# port forwarding to access grafana on a swarm stack
kubectl -n your_namespace port-forward service/swarm-grafana 3001:80