쿠버네티스 5

[CKA] 1차 시험 불합격.. 기억나는 대로 써보는 문제들. 1

1. Clusterrole 만들고 ServiceAccount와 특정 Namespace로 Binding 특정 리소스 타입만 허용 ClusterRole 예제 apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: secret-reader rules: - apiGroups: [""] resources: ["secrets"] verbs: ["get", "watch", "list"] # Role는 metadata: 아래에 namespace: 항목이 있지만 ClusterRole은 모든 namespace에 적용되기 때문에 해당 항목이 없다. ClusterRoleBinding 예제 apiVersion: rbac.authorization.k8..

IT/CKA 2022.03.06

[CKA] Mock Exam 2 풀이

1. Take a backup of the etcd cluster and save it to /opt/etcd-backup.db. # ETCD 백업문제, 백업 말고 Restore 쪽도 공부 해야한다. $ cd /etc/kubernetes/manifests $ cat etcd.yaml # ca.crt / server.crt / server.key 경로를 확이하고 다음 명령어를 실행 $ ETCDCTL_API=3 etcdctl --cacert= --cert= --key= snapshot save /opt/etcd-backup.db 2. Create a Pod called redis-storage with image: redis:alpine with a Volume of type emptyDir that las..

IT/CKA 2022.02.23

[CKA] Mock Exam 1 풀이

1. Deploy a pod named nginx-pod using the nginx:alpine image. # nginx-pod 라는 이름의 pod를 nginx:alpine 이라는 이미지를 사용하여 배포하라. $ kubectl run nginx-pod --image=nginx:alpine 2. Deploy a messaging pod using the redis:alpine image with the labels set to tier=msg. # messaging 이라는 pod를 redis:alpine 이라는 이미지를 사용하여 배포하라. lables는 tier=msg로 설정. $ kubectl run messaging --image=redis:alpine --labels=tier=msg 3. Crea..

IT/CKA 2022.02.23

[Kubernetes] Ubuntu에 Kubernetes 싱글노드로 구축하기.

회사에서 쿠버네티스를 다루다보니 집에서 테스트 환경을 만들어서 이것 저것 테스트해보고 싶은 생각이 들었습니다. 개인적으로 쓰고있는 서버는 1대인데 이걸 물리적으로 3대를 놓는건 현실적으로 불가능하고, 클라우드로 구축하자니 매달 비용이 발생하니 이것도 만만치 않습니다. 그렇다고 우분투에 KVM을 사용하여 가상환경으로 구축하자니 안그래도 리소스가 넉넉치 않은 개인서버에 하이퍼바이저라는 부담을 안겨주는거 같아 꺼려졌는데, 방법을 찾아보다 보니 싱글 노드로 쿠버네티스를 구축하는 방법이 있어서 이를 공유하고자 합니다. 전체적으로 kubeadm으로 일반적인 쿠버네티스 클러스터를 구성하는 방법과 다른 점은 없습니다. 다만 worker node를 join 하는 과정이 생략되고, control plane에 taint를 ..

IT/Kubernetes 2022.02.22