Using Amazon Elastic Kubernetes Service (EKS)
Before creating a new cluster, set up your computer as follows:
-
Create an Amazon Web Services (AWS) account if you do not already have one.
-
Enable the appropriate access keys and secret access keys.
-
Install the Kubernetes command-line tool,
kubectl. -
Install the command line tool
eksctlto work with Amazon EKS clusters.
Creating or Configuring Your Cluster (Isolated Mode)
| For more information about the isolated mode, see Node Isolation. |
-
To create your Amazon EKS cluster, see the Amazon EKS user guide.
For more information on managing access to AWS resources, see the Amazon Web Services documentation. -
Choose the
eksctlmethod. -
Confirm that the
AWS_ACCESS_KEYandAWS_SECRET_KEYenvironment variables are defined. -
Create a
cluster.ymlfile with the following content:apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: <cluster name> (1) region: <region> (2) version: "<version>" (3) nodeGroups: - name: common labels: io.saagie/installationId: <installationId> (4) io.saagie/type: common instanceType: m5.xlarge desiredCapacity: 2 - name: platform-<platformId> (5) labels: io.saagie/installationId: <installationId> (4) io.saagie/type: platform io.saagie/platform-assignable: ""<platformId>" (5) instanceType: m5.2xlarge desiredCapacity: 31 <cluster name>must be replaced with the name of your cluster. Your cluster name must be a string of case-insensitive letters, from a to z, or numbers.2 <region>must be replaced with the region in which the cluster will be used.3 <version>must be replaced with a Kubernetes version that is compatible with Saagie.Use quotes around the version number as eksctlrequires a string text and not a float number in the YAML file.4 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.5 <platformId>must be replaced with the ID of the platform. It is determined during the configuration of your platform. Its value is defined according to the number of platforms and their order, starting from one. You can therefore predict it.The order in which the platforms are declared during configuration must match the order of the platform IDs you entered here in the node pool. So remember it for later. -
Run the following command line:
eksctl create cluster -f cluster.yml
-
If you are using an existing Amazon EKS cluster, create your configuration file by running the following
awscommand line:aws eks --region <aws region> update-kubeconfig --name <cluster name> (1)Where:
1 <aws region>and<cluster name>must be replaced with your region and cluster name. -
Once your configuration file is created, check the connectivity.
Verifying Your Kubernetes Cluster
-
Run the following command line to verify that you have access to your Kubernetes cluster:
kubectl get nodesThe output of the command should look like the following:
NAME STATUS ROLES AGE VERSION ip-192-168-15-134.eu-west-1.compute.internal Ready <none> 9m8s v1.24.11-eks-a59e1f0 ip-192-168-35-150.eu-west-1.compute.internal Ready <none> 9m3s v1.24.11-eks-a59e1f0 ip-192-168-88-76.eu-west-1.compute.internal Ready <none> 9m7s v1.24.11-eks-a59e1f0All nodes must have the
readystatus.
Installing Calico
| Amazon EKS does not automatically install Calico, which is necessary for your Kubernetes cluster. |
-
To install Calico, see the Amazon EKS user guide.
-
If you did not install Calico when you created your cluster, run the following command line:
kubectl apply -f https://raw.githubusercontent.com/aws/amazon-vpc-cni-k8s/master/config/v1.3/calico.yaml (1)1 Make sure the version of Calico is compatible with your cluster.
Setting Up a Role for Saagie Jobs
-
Choose the AWS policy that meets your needs.
Example 1. Jobs that will not require access to AWS resources.ARN:
arn:aws:iam::aws:policy/AWSDenyAllExample 2. Jobs requiring access to S3.ARN:
arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccessTo create your own policy, see Creating IAM policies in the AWS user guide. -
Create the file
create-job-role.shas follows, defining the variables indicated:#!/bin/bash set -e # Define your variables here. Variables are explained below the code block. CLUSTER_NAME=<cluster-name> (1) SAAGIE_PREFIX=<installationId> (2) ROLE_NAME=<role-name> (3) AWS_POLICY_ARN=<policy-arn> (4) ISSUER_URL=$(aws eks describe-cluster \ --name $CLUSTER_NAME \ --query cluster.identity.oidc.issuer \ --output text) ISSUER_HOSTPATH=$(echo $ISSUER_URL | cut -f 3- -d'/') ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) PROVIDER_ARN="arn:aws:iam::$ACCOUNT_ID:oidc-provider/$ISSUER_HOSTPATH" cat > saagie-job-trust-policy.json << EOF { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "$PROVIDER_ARN" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringEquals": { "${ISSUER_HOSTPATH}:aud": "sts.amazonaws.com" }, "StringLike": { "${ISSUER_HOSTPATH}:sub": "system:serviceaccount:${SAAGIE_PREFIX}-project*:*" } } } ] } EOF aws iam create-role \ --role-name $ROLE_NAME \ --assume-role-policy-document file://saagie-job-trust-policy.json aws iam update-assume-role-policy \ --role-name $ROLE_NAME \ --policy-document file://saagie-job-trust-policy.json aws iam attach-role-policy \ --role-name $ROLE_NAME \ --policy-arn $AWS_POLICY_ARN aws iam get-role \ --role-name $ROLE_NAME \ --query Role.Arn --output textWhere:
1 <cluster-name>must be replaced with the name of your EKS cluster. Your cluster name must be a string of case-insensitive letters, from a to z, or numbers.2 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.3 <role-name>must be replaced with the name of the role that will be created. For example,saagie_job_role.4 <policy-arn>must be replaced with the ARN of the chosen policy for Saagie jobs.Take note of the <installationId>value, you will need it in several steps to come. -
Make the file executable with the following command line:
chmod +x create-job-role.sh -
Start the role creation by running the script file with the following command line:
./create-job-role.shThe ARN of the role you created is printed in the output.
Take note of the ARN, you will need it when configuring your instance.
Creating Storage Classes for Your Saagie Platform
-
Create the
storage.ymlfile for your Amazon EKS Kubernetes cluster.The following sample storage.ymlfile for Amazon EKS can be customized according to your needs.--- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: common-storageclass parameters: type: gp2 fsType: ext4 provisioner: kubernetes.io/aws-ebs allowVolumeExpansion: true --- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: <installationId>-storageclass (1) parameters: type: gp2 fsType: ext4 provisioner: kubernetes.io/aws-ebs allowVolumeExpansion: trueWhere:
1 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry. -
To store app data and job data on different provisioners, include the following lines in the same
storage.ymlfile:--- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: <installationId>-app-storageclass (1) parameters: (2) provisioner: (3) allowVolumeExpansion: trueWhere:
1 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.2 parametersmust contain the parameters for your app data.3 provisionermust indicate your second provisioner used to store app data. -
Apply the
storage.ymlfile by running the following command line:kubectl apply -f storage.yml -
Confirm that the storage classes are available by running the following command line:
kubectl get scExample 3. Output of the command for Amazon EKSNAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE common-storageclass kubernetes.io/aws-ebs Delete Immediate false 2m43s gp2 (default) kubernetes.io/aws-ebs Delete WaitForFirstConsumer false 5h25s <installationId>-storageclass kubernetes.io/aws-ebs Delete Immediate false 30s
Creating the Namespace
-
Create your namespace by running the following command line:
kubectl create namespace <installationId> kubectl label namespace <installationId> io.saagie/installationId=<installationId> kubectl label namespace <installationId> io.saagie/type=commonThe output of the command should look like the following:
namespace/<installationId> created ...Where:
-
<installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.
-
Applying or Installing Secret saagie-docker-config
-
Apply or install the secret:
-
Apply: If you receive the credentials in a Kubernetes secret file, apply the secret to your cluster by running the following
kubectlcommand line:kubectl apply -n <installationId> -f saagie-docker-config.yaml (1)Where:
1 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry. -
Install: If you receive a username and password, install the secret on your cluster by running the following
kubectlcommand line:kubectl create secret docker-registry -n <installationId> saagie-docker-config \ (1) --docker-server=<registry server> \ (2) --docker-username=<username> \ (3) --docker-password=<password> (4)Where:
1 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.2 <registry server>must be replaced with the Docker repository hosting Saagie images.3 <username>must be replaced with the username provided to you.4 <password>must be replaced with the password provided to you.
-
-
Edit the default service account to reference the
saagie-docker-configsecret by running the followingkubectlcommand line:kubectl patch serviceaccount -n <installationId> default -p '{"imagePullSecrets":[{"name" : "saagie-docker-config"}]}' (1)Where:
1 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry. -
Confirm that the secret is properly installed by running the following command line:
kubectl get secret -n <installationId> (1)Where:
1 <installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.The output of the command should look like the following:
NAME TYPE DATA AGE saagie-docker-config kubernetes.io/dockerconfigjson 1 2m43s
Installing Saagie in Offline Mode
Uploading Docker Images
To upload the Docker images to your registry, make sure you meet all the following requirements. You must have:
-
A machine with access to your Docker registry.
-
The
tararchives that are provided by Saagie and that contain the Saagie product and technologies. -
The Skopeo command line tool installed on your machine. For more information, see the Git repository dedicated to Skopeo.
-
The credentials to push the images into the registry, if any.
-
Run the following command line to decompress the archive:
untar xvf <product-tar-archive> (1)Where:
1 tar archiveis the file name of the Saagie product provided by Saagie itself.untar xvf <technologies-tar-archive> (1)Where:
1 tar archiveis the file name of the Saagie technologies provided by Saagie itself. -
OPTIONAL: If you need to require authentication, configure the user and password to connect to your registry using
skopeo login. For more information, you can refer to the Git repository dedicated to Skopeo. -
Run the following command line in the decompressed archive to start the image upload:
./pushall.sh <registry> (1)Where:
1 <registry>is the hostname of your Docker registry.
Installing Technology Repository
| For more information on adding technologies, see our SDK documentation. |
-
Copy the path to the
technologies.zipfile that contains your technologies. -
Run the following
saagiectlcommand line to install the repository in your cluster:./bin/saagiectl upload technologies --file <technologies-file> (1)Where:
1 <technologies-file>must be replaced with the path to yourtechnologies.zipfile.
Setting Up SMTP (Simple Mail Transfer Protocol) Requirements
An SMTP server is required to send, receive, and relay outgoing mail between your Saagie platform and users' email addresses. For this reason, Saagie must have access to your SMTP server and be compatible with the following configurations:
-
SMTP authentication can be anonymous or require authentication.
-
SMTP transport can be SMTP or SMTPS.
-
You must have a valid SSL certificate.
Once configured, you will be able to use your user email address to receive status alerts or change and reset the password associated with your Saagie account.
Deploying Your SSL Certificate
Make sure your SSL certificate is valid by checking the following constraints:
-
The certificate’s validity date must be correct.
-
The certificate must include at least the Saagie product URL.
-
The
KeyUsageattribute must include thedigitalSignatureandkeyEnciphermentelements.
-
Open your preferred terminal command.
-
To deploy your SSL certificate, run the following command line:
kubectl create secret tls saagie-common-tls --cert=cert.pem --key=cert.key -n <installationId> --dry-run=client -o yaml | kubectl apply -f -Where:
-
<installationId>must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.
-