docker安裝
 
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf repolist -v
#列出可安裝的版本
dnf list docker-ce --showduplicates | sort -r
#安裝指定版本
sudo dnf install docker-ce-3:18.09.1-3.el7
#確認版本
docker -v
 
docker-compose安裝
 
sudo yum -y install curl
 
curl -s https://api.github.com/repos/docker/compose/releases/latest \
  | grep browser_download_url \
  | grep docker-compose-Linux-x86_64 \
  | cut -d '"' -f 4 \
  | wget -qi -
 
 
chmod +x docker-compose-Linux-x86_64
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
docker-compose version
 
 
kubernetes kubectl安裝
 
cat <<EOF > /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
EOF
 
# Set SELinux in permissive mode (effectively disabling it)
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
 
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
 
systemctl enable --now kubelet
 
minikube安裝
 
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x minikube
 
sudo mkdir -p /usr/local/bin/
sudo install minikube /usr/local/bin/
 
minikube start
#如果出現以下錯誤
* minikube v1.4.0 on Centos 8.0.1905 (vbox/amd64)
* The "virtualbox" driver should not be used with root privileges.
* If you are running minikube within a VM, consider using --vm-driver=none:
執行參數加上--vm-driver=none
minikube start --vm-driver=none
 
驗證環境
kubectl config use-context minikube
kubectl cluster-info
kubectl config view
查看節點狀態
kubectl get nodes,po,svc --all-namespaces
 
Kubernetes Dashboard安裝
 
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
kubectl proxy or kubectl proxy --address='0.0.0.0' --accept-hosts='^*$'
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/.
 
Dashboard除錯
kubectl get pods --namespace kube-system
kubectl get pods --namespace kubernetes-dashboard
查看pod的log
kubectl -n kube-system logs kubernetes-dashboard-7c54d59f66-24p2r
查看namespace的日誌情況
kubectl describe po kubernetes-dashboard --namespace=kube-system
wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
kubectl delete -f kubernetes-dashboard.yaml
kubectl create -f kubernetes-dashboard.yaml
kubectl get pods --namespace kube-system
 
清除iptables規則
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
systemctl stop kubelet
systemctl stop docker
iptables --flush
iptables -tnat --flush
systemctl start kubelet
systemctl start docker
 
防火牆開放8001
firewall-cmd --zone=public --add-port=8001/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-all

 

By tony

自由軟體愛好者~喜歡不斷的思考各種問題,有新的事物都會想去學習嘗試 做實驗並熱衷研究 沒有所謂頂天的技術 只有謙虛及不斷的學習 精進專業,本站主要以分享系統及網路相關知識、資源而建立。 Github http://stnet253.github.io

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料