How to launch and use Amazon EKS

Amazon EKS Features

Steps to Set Up Amazon EKS

Prerequisites

Create the IAM Role

Create Amazon EKS Cluster

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: ekscluster
region: ap-south-1
nodeGroups:
- name: node1
desiredCapacity: 3
instanceType: t2.micro
ssh:
publicKeyName: eks

Creating EFS for storing data

Creating EFS Provisioner

kind: Deployment
apiVersion: apps/v1
metadata:
name: efs-provisioner
spec:
selector:
matchLabels:
app: efs-provisioner
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: efs-provisioner
spec:
containers:
- name: efs-provisioner
image: quay.io/external_storage/efs-provisioner:v0.1.0
env:
- name: FILE_SYSTEM_ID
value: fs-1d9f15cc
- name: AWS_REGION
value: ap-south-1
- name: PROVISIONER_NAME
value: eks/aws-efs
volumeMounts:
- name: pv-volume
mountPath: /persistentvolumes
volumes:
- name: pv-volume
nfs:
server: fs-1d9f15cc.efs.ap-south-1.amazonaws.com
path: /

Modifying RBAC

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: nfs-provisioner-role-binding
subjects:
- kind: ServiceAccount
name: default
namespace: thegreat
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io

Creating Storage Class

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: aws-efs
provisioner: eks/aws-efs
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: efs-jenkins
annotations:
volume.beta.kubernetes.io/storage-class: "aws-efs"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: efs-mysql
annotations:
volume.beta.kubernetes.io/storage-class: "aws-efs"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi

Deployments

apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: jenkins-mysql
labels:
app: jenkins
spec:
selector:
matchLabels:
app: jenkins
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: jenkins
tier: mysql
spec:
containers:
- image: mysql:5.7
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: confidential
key: sqlrootpassword
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: confidential
key: sqluser
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: confidential
key: sqlpassword
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: confidential
key: sqldb
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-ps
mountPath: /var/lib/mysql
volumes:
- name: mysql-ps
persistentVolumeClaim:
claimName: efs-mysql
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: jenkins
labels:
app: jenkinso
spec:
selector:
matchLabels:
app: jenkinso
tier: deploy
strategy:
type: Recreate
template:
metadata:
labels:
app: jenkinso
tier: deploy
spec:
containers:
- image: jenkins
name: jenkins
env:
- name: JENKINS_SLAVE_AGENT_PORT
valueFrom:
secretKeyRef:
name: jen
key: dcpassword
- name: database_connection_database
valueFrom:
secretKeyRef:
name: mysecret
key: slave
ports:
- containerPort: 8080
name: jenkins
volumeMounts:
- name: jenkins-ps
mountPath: /var/jenkins_home
volumes:
- name: jenkins-ps
persistentVolumeClaim:
claimName: efs-jenkins

Output

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

5 Open Source Questions with ONVIF

Separated EFI Boot Partitions located on different SSDs in Gigabyte AERO 15-X9

Python’s basic syntax

zsh: command not found

Liveblocks — the APIs for building multiplayer experiences, welcome to boldstart

READ/DOWNLOAD!* Learn PowerShell Scripting in a Month of Lunches FULL BOOK PDF & FULL AUDIOBOOK

Simplifying Jenkinsfiles

Image result for jenkins error

How Architecture Influences IoT Project Success

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
RAJNISH MISHRA

RAJNISH MISHRA

More from Medium

Like Linux ,I want to bring script to add path of binaries

Pecu Novus 2.0 : Code Falcon

CD5 & SOX11-Positive B-Cell Lymphoma with Aggressive Features

Child Panels and how do they differ from regular SMM Panel?

https://zosmm.com/