Read the following if you want to use Kubernetes from your local development environment.
You'll need to install and configure kubectl
CLI tool to interact with Kubernetes. There are instructions on kubectl configuration in the Cloud Platform User Guide.
fala
has two namespaces (environments):
When you become a member of the GitHub team laa-get-access
, you'll automatically get the ClusterRole - admin
role.
What is the ClusterRole -admin Allows admin access, intended to be granted within a namespace using a RoleBinding. If used in a RoleBinding, allows read/write access to most resources in a namespace, including the ability to create roles and rolebindings within the namespace. It does not allow write access to resource quota or to the namespace itself. https://kubernetes.io/docs/reference/access-authn-authz/rbac/#default-roles-and-role-bindings
You can find out more about roles in the Cloud Platform User Guide.
Docker images are stored in AWS ECR. To authenticate with the cla_public
repository, fetch the credentials by typing the following:
kubectl --namespace laa-fala-staging get secrets -o yaml
This command will return the encoded AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
. You can find out more by reading Authenticating with the repository.
The standard way of deploying is via CircleCI deploy jobs. See Deploy to Kubernetes using CircleCI.
If you need to deploy manually because, for example, CircleCI is offline, follow these steps:
-
Build the Docker image locally. For example:
docker build -t fala:latest .
-
Tag the build. For example:
docker tag fala:latest 926803513772.dkr.ecr.eu-west-1.amazonaws.com/laa-get-access/laa-fala:awesometag
-
Push the docker image. For example:
docker push 926803513772.dkr.ecr.eu-west-1.amazonaws.com/laa-get-access/laa-fala:awesometag
-
Deploy changes to Kubernetes by applying changes to the
deployment.yml
. This example takes thedeployment.yml
as input, changes the value ofimage
for the container namedapp
to926803513772.dkr.ecr.eu-west-1.amazonaws.com/laa-get-access/laa-fala:awesometag
, then pipes the updated yaml to the next command. Thekubectl apply
applies the yaml from stdin:kubectl set image --filename="kubernetes_deploy/staging/deployment.yml" --local --output=yaml app="926803513772.dkr.ecr.eu-west-1.amazonaws.com/laa-get-access/laa-fala:awesometag" | kubectl apply --filename=/dev/stdin
A similiar technique is used in deploy_to_kubernetes script. Of course, you could simply update the
deployment.yml
file directly and apply the changes.The
.circleci/deploy_to_kubernetes
relies on Circle CI environment variables being present,CIRCLE_BRANCH
andCIRCLE_SHA1
, so using the script from your local environment isn't possible yet. The plan is to remove these dependencies from the deploy script.