development tools

Integrate RazorOps with EKS


Prerequisite :

  • An existing Razorops account
  • Creating clusters on cloud AWS

Github Repository : https://github.com/Razorops-code/spring-boot.git

You can follow the these steps for creating AWS-EKS cluster click here

After creating EKS cluster

Setting Up Cluster Access

To access a cluster using kubectl, you have to set up a Kubernetes configuration file (commonly known as a ‘kubeconfig’ file) for the cluster. The kubeconfig file (by default named config and stored in the $HOME/.kube directory) provides the necessary details to access the cluster. Having set up the kubeconfig file, you can start using kubectl to manage the cluster. For razorops you can follow the process to access the cluster Click here

Next sign in to razorops with working github account

Next move to kubernetes section and click on Add New

Next you navigate to existing cluster

Here you can add name for cluster and authentication method

Here we can go with kubernetes ConfigFile (which is generated by connect credentials )

Here your config file looks like

Just copy and past at authentication section and click on Create Cluster

Next your cluster will added to Razorops kubernetes section successfully show like

**Cluster added process completed next move to workflow section for run a pipeline for deploy our application on to kubernetes eks cluster **

Now your in workflow dashboard

Next click on pipeline , you can navigate to the add a new pipeline dashboard

SELECT GITHUB

SELECT REPOSITORY

**And confirm it **

Enter the razorops pipeline

tasks:
  build-job:
    steps:
    - checkout
    - commands:
      - |
        mvn clean package                  # build the package
        ls -a
        ls target
    - docker/build:
       image: razoropsrepocode/spring       # build the image with Dockerfile
       push: true                   # push image to docker hub repository Which is integrated  
       tags: ["latest-v2"]
        # kubernetes deployment
  deploy-kubernetes:
    when: branch == 'master' # only run if code is pushed to develop branch
    depends: [build-job]
    steps:
    - checkout
    - commands:
      - |
        kubectl create -f deployment.yml
        kubectl create -f service.yml
        kubectl get svc

deployment.yml

apiVersion: apps/v1
kind: Deployment
metadata:
   name: sample-java-app
spec:
   replicas: 1
   selector:
     matchLabels:
       app: java-app
   template:
     metadata:
       labels:
         app: java-app
    spec:
       containers:
       - name: java-app
         image: razoropsrepocode/spring:latest-v2
         imagePullPolicy: Always
         ports:
         - containerPort: 8080

service.yml

apiVersion: v1
kind: Service
metadata:
   name: sample-java-app
spec:
   type: NodePort
   ports:
   - port: 8080
     targetPort: 8080
   selector:
     app: java-app

Next Run your first Build

Next automatically

  • clone source code from repository
  • Build code with maven
  • Create image with dockerfile
  • Push the image from dockerhub repository
  • Deploy the container on EKS cluster with kubernetes manifest file i.e (deployment.yml and service.yml )
  • Access the application with NodePort ip service

After pipeline running succeeded

We can find logs in logs section

Successfully Sample-java-app pod up and running and works on NodePort-service- 31103

We can find :31103 In my case i.e 3.109.54.147:31103/spring3/ Note:- This application working on tomcat server we need to mention application name i.e spring3</b>

Ready to get started?

30 Days Free Trial

Signup Here