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