Skip to content

Instantly share code, notes, and snippets.

View arunjayakumar01's full-sized avatar
😎

Arun J arunjayakumar01

😎
  • Accubits Technologies
  • India
View GitHub Profile

Since the update for the IP, databases are discontinued for the GeoIP module, and we have to include the Geoip2 module in Nginx, which is not prebuilt with Nginx and not available through apt-get and their official PPA. So we have to build Nginx from source by adding the GeoIP2 module source.

Backup old Nginx configs

sudo cp /etc/nginx/ /home/ubuntu

Remove old Nginx installation.

htpasswd setup

sudo apt install apache2-utils

sudo touch /etc/nginx/htpasswd

sudo htpasswd /etc/nginx/htpasswd username

Enter password

{
    "Version": "2008-10-17",
    "Id": "PolicyForPublicWebsiteContent",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": {
 "AWS": "*"
aws configure set preview.cloudfront true
export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export AWS_DEFAULT_REGION=eu-west-1
export AWS_DEFAULT_OUTPUT=json
aws cloudfront create-invalidation --distribution-id=xxxxxxxxxxxxxxxx --paths /
export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export AWS_DEFAULT_REGION=eu-west-1
export AWS_DEFAULT_OUTPUT=json
aws s3 rm s3://bucket-name --recursive

Kill Process that keeps the diskspace after deleteing the files

  • Some process keeps the diskspce after the files are deleted , these are usually solved by restarting the servers , to avaoid the downtime use this command. this will kill all the process holding the disk space.

    kill -9 $(lsof +L1 | awk -F ' ' '{print $2}')
    

Create ssh tunnel

  • TO create a ssh tunnel use

     ssh -i <path-to-key-file> user@host -L <local PC port>:<ip address accessed from ssh PC>:<ssh pc PORT>
    

    Example :

Configure a network load balancer for AWS EKS cluster

Expose the a kubernetes service in EKS using a Network Load balancer (NLB )
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-0.32.0/deploy/static/provider/aws/deploy.yaml
  • This will create a network load balancer will will be connected to your EKS cluster .

Horizontal pod scaler (HPA) in AWS eks

Check metric server Installed in your cluster
kubectl -n kube-system get deployment/metrics-server
  • If this returns none , add metric server by

kubernetes dashboard deployment - AWS EKS

Dashboard is a web-based Kubernetes user interface. You can use Dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster resources. You can use Dashboard to get an overview of applications running on your cluster, as well as for creating or modifying individual Kubernetes resources (such as Deployments, Jobs, DaemonSets, etc). For example, you can scale a Deployment, initiate a rolling update, restart a pod or deploy new applications using a deploy wizard.

Dashboard also provides information on the state of Kubernetes resources in your cluster and on any errors that may have occurred.

  • Check metric server is installed in your cluster