How to configure local kubectl to connect to kubernetes EKS cluster - kubernetes

I am very new at kubernetes.
I have created a cluster setup at AWS EKS
Now I want to configure kubectl at a local ubuntu server so that I can connect at AWS EKS cluster.
Need to understand the process. [ If at all it is possible ]

aws cli is used to create Kubernetes config (normally ~/.kube/config).
See details by:
aws eks update-kubeconfig help

You can follow this guide. You need to do following steps.
1.Installing kubectl
2.Installing aws-iam-authenticator
3.Create a kubeconfig for Amazon EKS
4.Managing Users or IAM Roles for your Cluster
Also take a look at configuring kubeconfig using AWS CLI here

Related

Unable to switch from Minikube to AWS EKS on windows for Deployment

I have minikube on my local machine for testing deployment and I ran commands like
kubectl apply -f testingfile.yaml
and it worked fine. Now I want to perform the same on aws eks. I have followed all steps given in https://docs.aws.amazon.com/eks/latest/userguide/sample-deployment.html. Created a config file and added that to the path. Commands like eksctl get cluster are correctly listing the clusters from aws eks but now when I run
kubectl apply -f testingfile.yaml
I am getting the following statement
deployment.apps/testingfile unchanged which means it is still applying the command inside minikube and not on aws eks. I have also deleted path variables related to minikube from environment variables but I am still unable to switch to aws eks for applying. I would like to deploy this on aws eks. Let me know what I am missing here
Checking your existing cluster contexts
There will multiple contexts one for Minikube and One for EKS
kubectl config get-contexs
change context to EKS if your config is set it will be there
kubectl config use-context <Name of context>
this way you can get changed to another clusters.

ArgoCD deployment to eks and aks

Is there any way that ArgoCD deploy to AKS and EKS cluster simultaneously. I don't see anything setting in ArgoCD to connect to another cluster. My aim is that I want ArgoCD to deploy in both AKS and EKS. As of now since ArgoCD is deployed to EKS so by default its picking it up but I want to connect ArgoCD with AKS as well. If there is a way please tell me.
Yes, you can deploy to multiple clusters or external clusters using the Argo CD.
please check this out : https://blog.doit-intl.com/automating-kubernetes-multi-cluster-config-with-argo-cd-5ac5e371ef01
if your argo CD is running local on same host
you can check the existing clusters using the
kubectl config get-contexts
and using cluster context Name you can add the context to the Argo CD via agro cli
argocd cluster add RESPECTIVE-CONTEXT name
https://argoproj.github.io/argo-cd/user-guide/commands/argocd_cluster_add/
readmore at : https://itnext.io/argocd-setup-external-clusters-by-name-d3d58a53acb0

Kubernetes, deploy from within a pod

We have an AWS EKS Kubernetes cluster with two factor authentication for all the kubectl commands.
Is there a way of deploying an app into this cluster using a pod deployed inside the cluster?
Can I deploy using helm charts or by specifying service account instead of kubeconfig file?
Can I specify a service account(use the one that is assigned to the pod with kubectl) for all actions of kubectl?
All this is meant to bypass two-factor authentication for the continuous deployment via Jenkins, by deploying jenkins agent into the cluster and using it for deployments. Thanks.
You can use a supported Kubernetes client library or Kubectl or directly use curl to call rest api exposed by Kubernetes API Server from within a pod.
You can use helm as well as long as you install it in the pod.
When you call Kubernetes API from within a pod by default service account is used.Service account mounted in the pod need to have role and rolebinding associated to be able to call Kubernetes API.

How to deploy application to a different cluster within same google cloud project?

I have one google cloud project, but have 2 different kubernetes clusters. Each of these clusters have one node each.
I would like to deploy an application to a specific kubernetes cluster. The deployment defaults to the other cluster. How can I specify which kubernetes cluster to deploy my app to?
See the cluster with which kubectl is currently communicating:
kubectl config current-context
Set the cluster with which you want kubectl to communicate:
kubectl config use-context my-cluster-name
See official docs here for more details

How to create Kubernetes Cluster using Kops with insecure registry?

I have to create a cluster with support of insecure docker registry. I want to use Kops for this. Is there any way to create cluster with insecure registry using Kops?
You can set insecure registry at cluster config edit time, after kops create cluster ... command (navigate to clusterSpec part of file):
$ kops edit cluster $NAME
...
docker:
insecureRegistry: registry.example.com
logDriver: json-file
...
Original link