자동으로 설치하는 명령어
$ curl -fsSL https://get.docker.com | sudo sh
-----------------------
[root@kube ~]# yum install -y yum-utils
[root@kube ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@kube ~]# yum -y install docker-ce docker-ce-cli containerd.io
...
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
...
[root@kube ~]# systemctl start docker
[root@kube ~]# systemctl status docker
[root@kube kube]# curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 60.9M 100 60.9M 0 0 14.7M 0 0:00:04 0:00:04 --:--:-- 14.8M
[root@kube kube]# ./minikube start --vm-driver=none
* minikube v1.20.0 on Centos 7.7.1908
* Using the none driver based on user configuration
X Exiting due to GUEST_MISSING_CONNTRACK: Sorry, Kubernetes 1.20.2 requires conntrack to be installed in root's path
root에서 사용이 안되므로 user계정에 docker 그룹으로 권한 설정
[root@kube kube]#
[root@kube kube]#
[root@kube kube]# sudo usermod -aG docker team01
[root@kube kube]# sudo systemctl restart docker
[root@kube kube]# sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@kube kube]# cp ./minikube /usr/local/bin/
[root@kube kube]# su - team01
Last login: Fri May 21 15:42:57 KST 2021 on pts/0
[team01@kube ~]$
[team01@kube ~]$ minikube start --vm-driver=docker
...
* Enabled addons: storage-provisioner, default-storageclass
* kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
[team01@kube ~]$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
[team01@kube ~]$
쿠버네티스 리포지토리 설정
[root@kube kube]# vi /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
[root@kube kube]# yum -y install kubectl
docker는 swap을 지원 안하므로 off 함
[root@kube kube]# vi ~/.bash_profile
swapoff -a
[root@kube kube]# . ~/.bash_profile
[root@kube kube]# kubectl
확인
[root@kube kube]# su - team01
[team01@kube ~]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane,master 50m v1.20.2
====================================
이미지 못가져 올때
[team01@kube ~]$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-deployment-585449566-pgcgl 0/1 ImagePullBackOff 0 4m15s
해결책
[team01@kube ~]$ minikube start --vm-driver=docker --insecure-registry="0.0.0.0/0"
참고
https://www.inflearn.com/questions/138980
ip 확인
#minikube service list
#minikube ip
웹 확인
[team01@kube ~]$ minikube service my-nginx
[team01@kube ~]$ minikube service my-nginx -n default
|-----------|----------|-------------|---------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|----------|-------------|---------------------------|
| default | my-nginx | 80 | http://192.168.49.2:32090 |
|-----------|----------|-------------|---------------------------|
* Opening service default/my-nginx in default browser...
http://192.168.49.2:32090
[team01@kube ~]$ curl $(minikube service my-nginx --url)
#curl $(minikube service <name> --url)
참고
https://itguava.tistory.com/124
'kubernetes' 카테고리의 다른 글
컨테이너 인프라환경 구축을 위한 쿠버네티스/도커 -2 (0) | 2021.08.31 |
---|---|
컨테이너 인프라환경 구축을 위한 쿠버네티스/도커 -1 (0) | 2021.08.31 |
kubernetes - nagios 설치 (0) | 2021.05.24 |
kubernetes - naigos pod 설치 (0) | 2021.05.22 |
kubernetes - centos 7 에서 설치 (0) | 2021.05.22 |