AWS

k8s 및 eksctl 업데이트 및 cluster 관리 및 user 관리

Kyle79 2020. 8. 10. 11:13
$ eksctl upgrade cluster --name=dhk-david --approve

$ kubectl rollout restart ${pod} # pod 을 recycle 함으로써, node 갱신

 

다중 클러스터 관리
aws eks --region region-code update-kubeconfig --name cluster_name

 

 

https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html

 

Updating an Amazon EKS cluster Kubernetes version - Amazon EKS

Although Amazon EKS runs a highly available control plane, you might experience minor service interruptions during an update. For example, if you attempt to connect to an API server just before or just after it's terminated and replaced by a new API server

docs.aws.amazon.com

 

 

 

https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html#installing-eksctl

 

The eksctl command line utility - Amazon EKS

The GitTag version should be at least 0.25.0. If not, check your terminal output for any installation or upgrade errors, or replace the address in step 1 with https://github.com/weaveworks/eksctl/releases/download/0.25.0/eksctl_Linux_amd64.tar.gz and compl

docs.aws.amazon.com

 

 

 

K8s user 관리

* kubectl apply -f .aws-auth.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth
  namespace: kube-system
data:
  mapRoles: |
    - rolearn: arn:aws:iam::xxxx:role/xxxx
      username: xxxx
      groups:
        - system:masters
  혹은
  mapUsers: |
    - userarn: arn:aws:iam::xxxx:user/xxxx
      username: xxxx
      groups:
        - system:masters

 

- aws eks update-kubeconfig --name eks-cluster-name --region aws-region 

(본인이 생성한 eks 는 내부 메타로 user 정보가 등록되어 있다)

혹은

- aws eks update-kubeconfig --name eks-cluster-name --region aws-region --role-arn arn:aws:iam::XXXXXXXXXXXX:role/xxxx

 

단, role 을 추가할 경우에는 신뢰관계를 추가한다.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::xxxx:user/xxxx"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}