Amazon EKS is Amazon's managed Kubernetes offering, similar to how Google Cloud offers managed Kubernetes clusters (GKE).
If your preferred cloud provider is Amazon, we strongly recommend using EKS instead of plain EC2. By using EKS, you will not need to manage your own Kubernetes control plane (complex). Instead, Amazon will provide it for you and you will only be responsible for managing Sourcegraph, which runs on the Kubernetes cluster.
Follow the EKS Getting Started guide to create the IAM EKS service role:
eksServiceRoleSourcegraph
, then Create role.https://amazon-eks.s3-us-west-2.amazonaws.com/cloudformation/2020-04-21/amazon-eks-vpc-sample.yaml
eks-vpc-sourcegraph
.For more details on these steps, refer to Amazon EKS prerequisites: Create your Amazon EKS cluster VPC.
sourcegraph
.eksServiceRoleSourcegraph
.eks-vpc-sourcegraph
.eks-vpc-sourcegraph-ControlPlaneSecurityGroup-
. (Do NOT select NodeSecurityGroup
.)For more details on these steps, refer to Amazon EKS prerequisites: Create your Amazon EKS cluster.
https://amazon-eks.s3.us-west-2.amazonaws.com/cloudformation/2020-04-21/amazon-eks-nodegroup.yaml
sourcegraph-worker-nodes
.sourcegraph
).eks-vpc-sourcegraph-ControlPlaneSecurityGroup-
(Do NOT select the NodeSecurityGroup
.)sourcegraph-node-group
.Users | Instance type | Min nodes | Max nodes | Cost est. | Attached Storage | Root Storage |
---|---|---|---|---|---|---|
10-500 | m5.4xlarge | 3 | 6 | $59-118/day | 500 GB | 100 GB |
500-2000 | m5.4xlarge | 6 | 10 | $118-195/day | 500 GB | 100 GB |
Note: You can always come back here later and modify these values to scale up/down the number of worker nodes. To do so, just visit the console page again, select Actions, Create Change Set For Current Stack, enter the same template URL mentioned above, modify the values and hit "next" until reviewing final changes, and finally Execute.
eks-vpc-sourcegraph-VPC
.eks-vpc-sourcegraph
subnets.For more details on these steps, refer to Worker Nodes: Amazon EKS-optimized Linux AMI.
kubectl
and configure access to the clusterOn your dev machine:
aws
CLI tool: bundled installer, other installation methods.aws configure
the CLI to use it.kubectl
and aws-iam-authenticator
by following these steps.kubectl
to interact with your cluster:
aws eks update-kubeconfig --name ${cluster_name}
Important: If kubectl
commands prompt you for username/password, be sure that kubectl version
reports a client version of v1.10+. Older versions of kubectl do not work with the authentication configuration provided by Amazon EKS.
At this point, kubectl get svc
should show something like:
$ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 172.20.0.1 <none> 443/TCP 4m
Now it is time to enable the worker nodes created by CloudFormation to actually join the Kubernetes cluster:
curl -O curl -o aws-auth-cm.yaml https://amazon-eks.s3.us-west-2.amazonaws.com/cloudformation/2020-04-21/aws-auth-cm.yaml
rolearn
in the file (do not modify the file otherwise) with the correct value. To find this value:
sourcegraph-worker-nodes
row.kubectl apply -f aws-auth-cm.yaml
kubectl get nodes --watch
until all nodes appear with status Ready
(this will take a few minutes).EKS does not have a default Kubernetes storage class out of the box, but one is needed.
Follow these short steps to create it. (Simply copy and paste the suggested file and run all suggested kubectl
commands. You do not need to modify the file.)
See Tutorial: Deploy the Kubernetes Dashboard.
Your Kubernetes cluster is now all set up and running!
Luckily, deploying Sourcegraph on your cluster is much easier and quicker than the above steps. :)
Follow our installation documentation to continue.