목록kubernetes (34)
클라우드 배우기

metallb 설치법 참고 https://metallb.universe.tf/ installation 및 configuration 부분 Kubernetes 내 LoadBalance 적용을 위하여 metallb 설치 metallb 사용을 위하여 Address Resolution Protocol 부분을 true로 적용 kubectl get configmap kube-proxy -n kube-system -o yaml | sed -e "s/strictARP: false/strictARP: true/" | \ yaml 파일 저장을 위하여 kubectl apply -f 가 아닌 wget 으로 다운로드 wget https://raw.githubusercontent.com/metallb/metallb/v0.13.11..

hostpath 설정 1. 파일 및 디렉토리 mount + nginx 설치 vi hostpod.yml : nignx 설치와 pod 내 test 디렉토리 및 babo.txt 파일 생성 pod명 : hostvol-nginx vi hostpod.yml apiVersion: v1 apiVersion: v1 kind: Pod metadata: name: hostvol-nginx labels: env: prod spec: containers: - name: n1 image: nginx imagePullPolicy: IfNotPresent ports: - containerPort: 80 volumeMounts: - mountPath: /test name: kang-vol - mountPath: /test/babo.t..

Label resource를 그룹화 하기 위해서 주로 사용 resource에 부착되는 키-값 쌍의 metadata로 키 값은 고유한 값이어야 함 사용자가 객체를 생성할 때 그 객체를 구분하기 위하여 임의로 원하는 값을 지정하여 사용 Selector와 함께 사용 Selector Pod 스펙, 서비스 정의와 같은 오브젝트에서 레이블 셀렉터를 사용하여 특정 레이블을 가진 리소스 선택 가능 Label로 태그된 Pod의 부분 집합을 택하여 원하는 작업 수행 kubectl run nginx-1 --image nginx --port 80 --labels="env=prod" : 라벨이름이 env=prod인 nginx 실행 (pod 이름 : nginx-1 이미지 : nginx, port :80 개방) kubectl ge..

구성도 master vi. sh #! /bin/bash yum install -y rdate rdate -s time.bora.net # selinux off setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux # firewall off & disable systemctl stop firewalld systemctl disable firewalld # Masteer # firewall-cmd --add-port={80,443,6443,2379,2380,10250,10251,10252,30000-32767}/tcp --permanent # Node # firewall-cmd --add-port={80,443,..

Empty Dir 임시 volume 으로 생명주기가 pod와 동일 동일 pod 내, 여러 개의 Container가 존재한다면 Empty Dir 공유 가능 pod가 있는 node 안에 volume의 name으로 존재 vi emptydp.yml apiVersion: apps/v1 kind: Deployment metadata: name: host-dep labels: env: prod spec: replicas: 2 selector: matchLabels: host: anginx template: metadata: name: temp-anginx labels: host: anginx spec: containers: - name: n1 image: nginx imagePullPolicy: Never ports..

vi mysql.yml apiVersion: v1 kind: Pod metadata: name: mysql labels: app: mysql spec: containers: - name: m1 image: mysql:5.6 imagePullPolicy: IfNotPresent env: - name: MYSQL_ROOT_PASSWORD value: It12345! - name: MYSQL_DATABASE value: wordpress - name: MYSQL_ROOT_HOST value: "%" ports: - containerPort: 3306 nodeName: node3 kubectl apply -f mysql.yml kubectl get pods -o wide vi wordpress.yml apiVe..

vi index.html K8S-CPTEST-WEBSERVER nginx 로 pod 생성 kubectl run app-nginx --image nginx --port 80 kubedctl get pods -o wide kubectl cp index.html app-nginx:/usr/share/nginx/html/index.html lynx 10.42.0.1 http 로 pod 생성 kubectl run app-http --image httpd --port 80 kubectl get pods -o wide kubectl cp index.html app-ninx:/usr/local/apache2/htdocs/html/index.html lynx 10.32.0.2

Kubernetes 단일 Pods 내 다수 Container는 권장하지 않음 yum install -y haproxy yum install -y http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm vi /etc/yum.repos.d/mysql-community.repo vi myword.yml --- apiVersion: v1 kind: Pod metadata: name: word-sql labels: env: prod spec: containers: - name: wordpress image: wordpress:5.6 imagePullPolicy: IfNotPresent env: - name: WORDPRESS_DB_HOST val..

Deployments Pod와 Relicaset의 관리와 업데이트를 하는 controlloer replicas 는 service 로 전송이 불가하기 때문에 deployments로 사용 권장 Pods 만으로는 service 운영 시, 복제가 불가하기 때문에 deployments 사용 권장 구성안 yml 파일로 nginx deployments 로 2개 생성 replicas 6개로 복제 후, 외부 전송 watch -n 1 kubectl get deploy,rs,pods : 실시간으로 deploy, replicas, pods 의 상태 확인 가능 vi nginxdep.yml apiVersion: apps/v1 kind: Deployment metadata: name: dep-nginx labels: env: de..

httpd를 실행하는 pod 생성, 단 복제본은 3개 구성 확인 후 복제본의 개수는 2개로 명령어 조절 실행중인 replicaset 의 설정 파일을 변경해서 5개로 증가 확인 후 명령어를 이용 3개로 축소 replicas 는 service 로 전송 불가, 전송하기 위해서는 pods 또는 deployments로 진행 필수 kubectl api-resources : api resource 확인 vi nginxrep.yml vi httprep.yml apiVersion: apps/v1 kind: ReplicaSet metadata: name: rep-http labels: env: rep-http spec: replicas: 3 selector: matchLabels: env: app-http template..