LAUNCH NEXT CLOUD WITH EKS

LAUNCH NEXT CLOUD WITH EKS

AWS (Amazon Web Services) is a comprehensive, evolving cloud computing platform provided by Amazon that includes a mixture of infrastructure as a service (IaaS), platform as a service (PaaS) and packaged software as a service (SaaS) offerings. AWS services can offer an organization tools such as compute power, database storage, and content delivery services.

EKS:

Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service that makes it easy for you to run Kubernetes on AWS without needing to stand up or maintain your own Kubernetes control plane. Kubernetes is an open-source system for automating the deployment, scaling, and management of containerized applications.

Amazon EKS runs Kubernetes control plane instances across multiple Availability Zones to ensure high availability. Amazon EKS automatically detects and replaces unhealthy control plane instances, and it provides automated version upgrades and patching for them.

NextCloud:

Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices.

Nextcloud application functionally is similar to Dropbox, Office 365 or Google Drive, but can be used on home-local computers or for off-premises file storage hosting. Office functionality is limited to x86/x64 based servers as OnlyOffice does not support ARM processors. In contrast to proprietary services the open architecture enables users to have full control of their data.

Make sure you have the following configured

AWS CLI

AWS cli configure with the account with IAM role permission

IAM authenticator

kubectl

eksctl

First we have to create the cluster using the following code:

apiVersion: eksctl.io/v1alpha5
	kind: ClusterConfig
	

	metadata:
	  name: lwcluster
	  region: ap-south-1
	

	nodeGroups:
	   - name: ng1
	     desiredCapacity: 2
	     instanceType: t2.micro
	     ssh:
	        publicKeyName: tfkey
	   - name: ng2
	     desiredCapacity: 1
	     instanceType: t2.small
	     ssh:
	        publicKeyName: tfkey
	   - name: ng-mixed
	     minSize: 2
	     maxSize: 5
	     instancesDistribution:
	       maxPrice: 0.017
	       instanceTypes: ["t3.small", "t3.medium"] # At least one instance type should be specified
	       onDemandBaseCapacity: 0
	       onDemandPercentageAboveBaseCapacity: 50
	       spotInstancePools: 2     
	     ssh:
	        publicKeyName: tfkey

then run the following command to create the cluster

eksctl create cluster -f cluster.yml

Then create a config file they will create own config file

kubectl config view

aws eks update-kubeconfig — name lwcluster

Then create yml file for project launch using nodepad

we have create cloud file for launching nextcloud in this we have created PVC for this and service

apiVersion: v1
	kind: Service
	metadata:
	  name: nextcloud
	  labels:
	    app: nextcloud
	spec:
	  ports:
	    - port: 80
	  selector:
	    app: nextcloud
	    tier: frontend
	  type: LoadBalancer
	---
	apiVersion: v1
	kind: PersistentVolumeClaim
	metadata:
	  name: nc-pv-claim
	  labels:
	    app: nextcloud
	spec:
	  accessModes:
	    - ReadWriteOnce
	  resources:
	    requests:
	      storage: 2Gi
	---
	apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
	kind: Deployment
	metadata:
	  name: nextcloud
	  annotations:
	    volume.beta.kubernetes.io/storage-class: "aws-efs"
	  labels:
	    app: nextcloud
	spec:
	  selector:
	    matchLabels:
	      app: nextcloud
	      tier: frontend
	  strategy:
	    type: Recreate
	  template:
	    metadata:
	      labels:
	        app: nextcloud
	        tier: frontend
	    spec:
	      containers:
	      - image: nextcloud
	        name: nextcloud
	        env:
	        - name: MYSQL_HOST
	          value: nextcloud-mysql
	        - name: MYSQL_PASSWORD
	          valueFrom:
	            secretKeyRef:
	              name: mysql-pass
	              key: password
	        ports:
	        - containerPort: 80
	          name: nextcloud
	        volumeMounts:
	        - name: nextcloud-persistent-storage
	          mountPath: /var/www/html
	      volumes:
	      - name: nextcloud-persistent-storage
	        persistentVolumeClaim:
	        
             claimName: nc-pv-claim

Now create the file storage.yml

kind: StorageClass
	apiVersion: storage.k8s.io/v1
	metadata:
	  name: aws-efs
	provisioner: lw-course/aws-efs
	---
	kind: PersistentVolumeClaim
	apiVersion: v1
	metadata:
	  name: efs-nextcloud
	  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

create the file for database connectivity

apiVersion: v1
	kind: Service
	metadata:
	  name: nextcloud-mysql
	  labels:
	    app: nextcloud
	spec:
	  ports:
	    - port: 3306
	  selector:
	    app: nextcloud
	    tier: mysql
	  clusterIP: None
	---
	apiVersion: v1
	kind: PersistentVolumeClaim
	metadata:
	  name: mysql-pv-claim
	  annotations:
	    volume.beta.kubernetes.io/storage-class: "aws-efs"
	  labels:
	    app: nextcloud
	spec:
	  accessModes:
	    - ReadWriteOnce
	  resources:
	    requests:
	      storage: 2Gi
	---
	apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
	kind: Deployment
	metadata:
	  name: nextcloud-mysql
	  labels:
	    app: nextcloud
	spec:
	  selector:
	    matchLabels:
	      app: nextcloud
	      tier: mysql
	  strategy:
	    type: Recreate
	  template:
	    metadata:
	      labels:
	        app: nextcloud
	        tier: mysql
	    spec:
	      containers:
	      - image: mysql:5.6
	        name: mysql
	        env:
	        - name: MYSQL_ROOT_PASSWORD
	          valueFrom:
	            secretKeyRef:
	              name: mysql-pass
	              key: password
	        ports:
	        - containerPort: 3306
	          name: mysql
	        volumeMounts:
	        - name: mysql-persistent-storage
	          mountPath: /var/lib/mysql
	      volumes:
	      - name: mysql-persistent-storage
	        persistentVolumeClaim:
	        
            claimName: mysql-pv-claim

create the file for creating efs storage

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-375ed4e6
	            - name: AWS_REGION
	

	              value: ap-south-1
	

	            - name: PROVISIONER_NAME
	

	              value: lw-course/aws-efs
	

	          volumeMounts:
	

	            - name: pv-volume
	

	              mountPath: /persistentvolumes
	

	      volumes:
	

	        - name: pv-volume
	

	          nfs:
	

	            server: fs-375ed4e6.efs.ap-south-1.amazonaws.com

then create the kustomization file and the names of the files in the order you want to execute and execute only this file than.

apiVersion: kustomize.config.k8s.io/v1beta1
	kind: Kustomization
	secretGenerator:
	- name: mysql-pass
	  literals:
	  - password=dbmysql
	resources:
	  - create-efs-provisioner.yaml
	  - create-rbac.yaml
	  - create-storage.yaml
	  - mysql-deploy.yaml
	  - 
      -nextcloud-deploy.yaml


要查看或添加评论,请登录

Shradha Seth的更多文章

  • k-mean clustering in security domain

    k-mean clustering in security domain

    ? Clustering:- Clustering is one of the most common exploratory data analysis technique used to get an intuition about…

    1 条评论
  • Face Detection using python

    Face Detection using python

    Task 06 ??????? Team Task Task Description ?? ?? Create a program that perform below mentioned task upon recognizing a…

    2 条评论
  • Javascript!!

    Javascript!!

    ?? Task 7.2 - ?? Write a blog explaining the usecase of javascript in any of your favorite industries.

  • Confusion Matrix and cyber security

    Confusion Matrix and cyber security

    Confusion matrix is a fairly common term when it comes to machine learning. Today I would be trying to relate the…

  • GUI Application On Docker Container?? ??????

    GUI Application On Docker Container?? ??????

    ?? Task Description?? ?? GUI container on the Docker ?? Launch a container on docker in GUI mode ?? Run any GUI…

  • Deploying Simple Machine Learning Model inside Docker Container

    Deploying Simple Machine Learning Model inside Docker Container

    Task Description ?? ?? Pull the Docker container image of CentOS image from Docker Hub and Create a new container ??…

    1 条评论
  • Creating VPC Infrastucture and NAT gateway using Terraform

    Creating VPC Infrastucture and NAT gateway using Terraform

    The goal is to create a scenario in which we will create our own virtual private cloud (VPC) with a public and a…

    2 条评论
  • Creating VPC Infrastucture: Terraform & Hosting WordPress

    Creating VPC Infrastucture: Terraform & Hosting WordPress

    We have to create a web portal for our company with all the security as much as possible. So, we use Wordpress software…

  • Creating AWS infrastructure with AWS: EFS using Terraform

    Creating AWS infrastructure with AWS: EFS using Terraform

    Task details: Create the key and security group which allow the port 80. Launch EC2 instance.

社区洞察

其他会员也浏览了