Can't run jenkins slave on ECS fargate - jenkins

I'm using Amazon Elastic Container Service plugin which allows running Jenkins slaves on AWS ECS. Functionality which allows running slaves on EC2 type of ECS works perfectly, but I can't run slaves on Fargate. Tasks in the cluster are not created and no any activity in the ECS cluster at all. Can anyone share configurations of Amazon Elastic Container Service plugin which successfully works with Fargate, or help with an issue?

Related

Run Docker image using Rancher on AWS EKS and local device

Can I use a Rancher desktop to run workload images on the local machine on the Kubernetes cluster in containers and also offload workload on AWS EKS (run local images on AWS EKS cluster EC2 instances )? I mean can I manage both usages together using one Rancher desktop app?
The workload can be printing numbers from 1-20 using for loop and I want to offload this workload(by creating its image )to AWS EKS cloud or offload the workload to machine2 and run its image in a container and bring the output back to my machine.
I was thinking about using rancher or minikube to run local Kubernetes but I needed a tool which can also offload the work to AWS EKS and also to another machine. (binary usage) So I decided to do some research I am stuck at this point. Can Rancher Solve my problems?

Can I deploy Ubuntu Docker directly to EC2 (not inside Ubuntu)?

All the solutions I know to deploy a Docker to EC2 involves running it inside a wrapping Ubuntu.
I want to deploy my Ubuntu docker to EC2 so it will be a standalone EC2 image running by itself.
Is that feasible?
You can not launch EC2 with docker image, EC2 uses AWS AMI to launch instance.
One to way to launch your docker image directly with fargate, which does not manage any instance but will run your image as a standalone container.
AWS Fargate is a compute engine for Amazon ECS that allows you to run
containers without having to manage servers or clusters. With AWS
Fargate, you no longer have to provision, configure, and scale
clusters of virtual machines to run containers. This removes the need
to choose server types, decide when to scale your clusters, or
optimize cluster packing. AWS Fargate removes the need for you to
interact with or think about servers or clusters.

Deploying multiple docker containers to AWS ECS

I have created a Docker containers using docker-compose. In my local environment, i am able to bring up my application without any issues.
Now i wanted to deploy all my docker containers to the AWS EC2 (ECS). After going over the ECS documentation, i found out that we can make use of the same docker-compose to deploy in ECS using ECS-CLI. But ECS-CLI is not available for windows instances as of now. So now i am not sure how to use my docker-compose to build all my images using a single command and deploy it to the ECS from an windows instance.
It seems like i have to deploy my docker containers one by one to ECS as like below steps,
From the ECS Control Panel, create a Docker Image Repository.
Connect your local Docker client with your Docker credentials in ECS:
Copy and paste the Docker login command from the previous step. This will log you in for 24 hours
Tag your image locally ready to push to your ECS repository – use the repo URI from the first step
Push the image to your ECS repoository\
create tasks with the web UI, or manually as a JSON file
create a cluster, using the web UI.
Run your task specifying the EC2 cluster to run on
Is there any other way of running the docker containers in ECS ?
Docker-Compose is wrong at this place, when you're using ECS.
You can configure multiple containers within a task definition, as seen here in the CloudFormation docs:
ContainerDefinitions is a property of the AWS::ECS::TaskDefinition resource that describes the configuration of an Amazon EC2 Container Service (Amazon ECS) container
Type: "AWS::ECS::TaskDefinition"
Properties:
Volumes:
- Volume Definition
Family: String
NetworkMode: String
PlacementConstraints:
- TaskDefinitionPlacementConstraint
TaskRoleArn: String
ContainerDefinitions:
- Container Definition
Just list multiple containers there and all will be launched together on the same machine.
I got the same situation as you. One way to resolve this was using the Terraform to deploy our containers as a Task Definitions on AWS ECS.
So, we using the docker-compose.yml to run locally and the terraform is a kind of mirror of our docker-compose on AWS.
Also another option is Kubernetes that you can translate from docker-compose to Kubernetes resources.

Jenkins slave running in ECS cluster start container slow

I'm using jenkins slave in AWS ECS cluster, everytimes when I press build, slave container take 3mins to start, how can I speed up this?

How do I create a local kubernates cluster in a VM?

I have a set of docker images running in a Kubernates cluster on GKE. I have a Jenkins server running on a VM in GKE.
I have docker builds and GKE deploys running on the Jenkins server, but I would like to start up a 'local' cluster on the Jenkins server after successful builds, run my dockers in that cluster, run my tests towards the cluster, and then close down the local cluster before deploying the docker images to GKE.
I know about minikube, but they state that you are not able to run nested VM's, and I wonder if this blocks my dream of test my cluster before deploying it?
Do I have to run my local cluster on a physical server to be able to run my tests, or is there a solution to my problem?
Have you considered using kubeadm?
You can run a Kubernetes cluster within your Jenkins VM. Setup is a bit different than minikube and it's still in beta but it will let you test your cluster before the final deployment.

Resources