본문 바로가기

전체 글535

[kubernetes] Network Policy 네트워크 폴리시는 라벨/ ipblock/네임스페이스에 대해서 특정 조건만 허용하는 기능이다. * 정보를 넣지 않으면 모두 차단 나가는 트래픽은 egress , 들어오늘 트래픽을 Ingress 라하며 NP는 여러 개가 있으면 or식으로 모두 합쳐지게 되어, 하나의 오프젝트로 모두 설명할 필요 없이 세분화하여 나눠 관리가 가능하다. 아래의 예제를 통해 확인해 보자 . apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: test-network-policy namespace: default spec: podSelector: matchLabels: role: db policyTypes: - Ingress - Egress ingress: - f.. 2024. 1. 8.
[kubernetes] Lebel 추가/삭제 명령 대부분 추가하는 명령어는 익숙하다 . kubectl label [서비스] [서비스명] -n key=value 삭제하는 방법은 하기와 같다. 서비스 my-service에 키가 app 인 label을 삭제한다. kubectl label service my-service app- 2024. 1. 8.
[AWS] EKS Automation- 7주차 - FLUX 참조 -https://malwareanalysis.tistory.com/612 EKS 스터디 - 7주차 flux 예제 이 글은 flux가 무엇이고 간단한 예제를 살펴봅니다. 예제를 쉽게 따라하기 위해 모든 예제는 flux CLI를 사용합니다. flux란? flux는 쿠버네티스를 위한 gitops 도구입니다. flux는 git에 있는 쿠버네티스 malwareanalysis.tistory.com Flux 설치 및 bootstrap 진행 # Flux CLI 설치 curl -s https://fluxcd.io/install.sh | sudo bash . 우층상단 프로필 > setting > 좌측 개발자 > classic tocken 발급 Gituser는 이메일이 아닌 nic name --- 자신의 Github에.. 2023. 6. 7.
[AWS] EKS Automation- 7주차 - ACK API Gateway생성 2023.06.07 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - ACK S3 생성 2023.06.07 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - ACK EC2, VPC생성 2023.06.07 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - ACK RDS생성 ACK를 사용하여 APIGateway를 생성하고 삭제해보도록하자. 내용은 위와 동일하다. 참조 : https://aws-controllers-k8s.github.io/community/docs/tutorials/apigatewayv2-reference-example/ Manage HTTP APIs with the ACK APIGatewayv2 Controll.. 2023. 6. 7.
[AWS] EKS Automation- 7주차 - ACK RDS생성 2023.06.07 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - ACK S3 생성 2023.06.07 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - ACK EC2, VPC생성 ACK를 사용하여 RDS를 생성하고 삭제해보도록하자. 내용은 위와 동일하다. RDS : 지원 엔진 - Aurora(MySQL & PostgreSQL), RDS for PostgreSQL, RDS for MySQL, RDS for MariaDB, RDS for Oracle, RDS for SQL Server 컨트롤러 설치 -참조( https://aws-controllers-k8s.github.io/community/docs/tutorials/rds-example/ ,htt.. 2023. 6. 7.
[AWS] EKS Automation- 7주차 - ACK EC2, VPC생성 2023.06.06 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - 실습환경 구축 2023.06.07 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - ACK S3 생성 동일하게 S3와 비슷한 방법으로 EC2, VPC를 생성을 실습해 보겠습니다. 실습 컨트롤러 설치 (참조 -https://aws-controllers-k8s.github.io/community/docs/tutorials/ec2-example/ , https://gallery.ecr.aws/aws-controllers-k8s/ec2-chart , https://github.com/aws-controllers-k8s/ec2-controller) # 서비스명 변수 지정 및 helm 차트 다.. 2023. 6. 7.
[AWS] EKS Automation- 7주차 - ACK S3 생성 2023.06.06 - [클라우드/AWS] - [AWS] EKS Automation- 7주차 - 실습환경 구축 실습 순서는 ACK Controller 설치 / IRSA 설정 / S3 생성, 삭제 입니다. 실습 ACK Controller 설치 - 참고 (https://gallery.ecr.aws/aws-controllers-k8s) # 서비스명 변수 지정 export SERVICE=s3 # helm 차트 다운로드 #aws ecr-public get-login-password --region us-east-1 | helm registry login --username AWS --password-stdin public.ecr.aws export RELEASE_VERSION=$(curl -sL https://a.. 2023. 6. 7.
[AWS] EKS Automation- 7주차 - 실습환경 구축 2023.05.31 - [클라우드/AWS] - [AWS] EKS Security- 6주차 - 실습환경 배포 2023.05.23 - [클라우드/AWS] - [AWS] EKS Autoscaling - 5주차 -실습환경 배포 실습환경 구성은 지난 번들과 동일합니다. curl -O https://s3.ap-northeast-2.amazonaws.com/cloudformation.cloudneta.net/K8S/eks-oneclick6.yaml # CloudFormation 스택 배포 예시) aws cloudformation deploy --template-file eks-oneclick6.yaml --stack-name myeks --parameter-overrides KeyName=kp-gasida SgIng.. 2023. 6. 6.
[AWS] EKS Automation- 7주차 스터디의 마지막 목차 Automation입니다. 이번 오토메이션은 ACK (AWS Controller for Kubernetes )와 Flux를 이용하여 AWS의 리소스를 생성해보는 시간을 가졌는데요. ACK 같은 경우 AWS의 리소스를 k8s에서 직접 정의하고 사용할 수 있도록 구성되어 있습니다. kubectl 명령어로 s3, ec2, rds, api gateway등을 구성할 수 있습니다. ACK가 지원하는 서비스는 https://aws-controllers-k8s.github.io/community/docs/community/services/ 에서 확인이 가능합니다. GA 서비스 : ApiGatewayV2, CloudTrail, DynamoDB, EC2, ECR, EKS, IAM, KMS, Lambd.. 2023. 6. 6.
[AWS] EKS Security- 6주차 - IRSA EC2 Instance Profile : 사용하기 편하지만, 최소 권한 부여 원칙에 위배하며 보안상 권고하지 않음 - 링크 → IRSA를 사용 권장 실습 목표 : 파드가 특정 IAM 역할로 Assume 할때 토큰을 AWS에 전송하고, AWS는 토큰과 EKS IdP를 통해 해당 IAM 역할을 사용할 수 있는지 검증 실습 1 -https://aws.amazon.com/ko/blogs/containers/diving-into-iam-roles-for-service-accounts/ # 파드1 생성 cat 웹 관리 콘솔에서 CloudFormation Stack >> IAM Role 확인 # aws-load-balancer-controller IRSA는 어떤 동작을 수행할 것 인지 생각해보자! eksctl get.. 2023. 6. 1.
[AWS] EKS Security- 6주차 - EKS 인증/인가 사용자/애플리케이션 → k8s 사용 시 ⇒ 인증은 AWS IAM, 인가는 K8S RBAC 으로 진행되는데요. 이번 실습을 통해서 인증 인가가 어떻게 되는지 이해하셨으면 좋겠습니다. 관련 플러그 설치 # 설치 kubectl krew install access-matrix rbac-tool rbac-view rolesum # Show an RBAC access matrix for server resources kubectl access-matrix # Review access to cluster-scoped resources kubectl access-matrix --namespace default # Review access to namespaced resources in 'default' # RBAC L.. 2023. 6. 1.
[AWS] EKS Security- 6주차 - 실습환경 배포 2023.05.23 - [클라우드/AWS] - [AWS] EKS Autoscaling - 5주차 -실습환경 배포 똑같이 진행합니다. cloud formaion에 https://s3.ap-northeast-2.amazonaws.com/cloudformation.cloudneta.net/K8S/eks-oneclick5.yaml 을 입력하여 진행하면되는데 엑세스키/ 시크릿키 / keypire만 별도 기입하시면됩니다. yaml 내용 확인하기 더보기 AWSTemplateFormatVersion: '2010-09-09' Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: ">" Parameters: - KeyName - MyIam.. 2023. 5. 31.
[AWS] EKS Security- 6주차 안녕하세요. 이번주는 6주차 EKS Security 파트를 진행했는데요. k8s의 security 는 인증/인가 부분을 롤/롤바인딩을 serviceaccount에 할당하여 권한을 부여하는 부분이 있는데 EKS는 IAM관련하여 인증/인가하는 부분이 있습니다. 인증/인가도 aws의 서비스와 연동시켜 놓은 것이 놀라웠고 보안/네트워크가 원래 어렵자나요. 그래도 제가 학습한 내용을 모두 이해하셨으면 좋겠습니다. K8S의 인증 인가 참고 > 링크 링크 인증인가는 .kube/config 파일에서 관련 내용을 확인 할 수 있는데 k8s api 서버와 통신을 하기 위한 정보들이 기입되어 있다. 예제 cat .kube/config apiVersion: v1 clusters: - cluster: certificate-au.. 2023. 5. 31.
[AWS] EKS Autoscaling - 5주차 - Karpenter : K8S Native AutoScaler & Fargate # 카펜터 설치를 위한 환경 변수 설정 및 확인 export CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${CLUSTER_NAME} --query "cluster.endpoint" --output text)" export KARPENTER_IAM_ROLE_ARN="arn:aws:iam::${AWS_ACCOUNT_ID}:role/${CLUSTER_NAME}-karpenter" echo $CLUSTER_ENDPOINT $KARPENTER_IAM_ROLE_ARN # EC2 Spot Fleet 사용을 위한 service-linked-role 생성 확인 : 만들어있는것을 확인하는 거라 아래 에러 출력이 정상! # If the role has already been.. 2023. 5. 23.
[AWS] EKS Autoscaling - 5주차 - CPA - Cluster Proportional Autoscaler 실습 구성 helm repo add cluster-proportional-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler # CPA규칙을 설정하고 helm차트를 릴리즈 필요 helm upgrade --install cluster-proportional-autoscaler cluster-proportional-autoscaler/cluster-proportional-autoscaler # nginx 디플로이먼트 배포 cat 2023. 5. 23.
[AWS] EKS Autoscaling - 5주차 - Cluster Autoscaler 실습 전 미리 확인해보기 aws ec2 describe-instances --filters Name=tag:Name,Values=$CLUSTER_NAME-ng1-Node --query "Reservations[*].Instances[*].Tags[*]" --output yaml | yh export ASG_NAME=$(aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='myeks']].AutoScalingGroupName" --output text) aws autoscaling update-auto-scaling-group --auto-scalin.. 2023. 5. 23.
[AWS] EKS Autoscaling - 5주차 -Vertical Pod Autoscaler 설치 # 코드 다운로드 git clone https://github.com/kubernetes/autoscaler.git cd ~/autoscaler/vertical-pod-autoscaler/ tree hack # 배포 과정에서 에러 발생 : 방안1 openssl 버전 1.1.1 up, 방안2 브랜치08에서 작업 ERROR: Failed to create CA certificate for self-signing. If the error is "unknown option -addext", update your openssl version or deploy VPA from the vpa-release-0.8 branch. # 프로메테우스 임시 파일 시스템 사용으로 재시작 시 저장 메트릭과 대시보드 정보가 .. 2023. 5. 23.
[AWS] EKS Autoscaling - 5주차 -Kubernetes based Event Driven Autoscaler 실습 설치 # KEDA 설치 cat 2023. 5. 23.
반응형