文章主目录地址
其他组件的安装
开启命令提示
yum install bash-completion -y
echo "source <(kubectl completion bash)" >> ~/.bashrc
source .bashrc
集群网络安装
安装flannel类型
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
安装calico类型
curl https://projectcalico.docs.tigera.io/manifests/calico.yaml -O
kubectl apply -f calico.yaml
helm安装calico
helm repo add projectcalico https://projectcalico.docs.tigera.io/charts
helm install calico projectcalico/tigera-operator --version v3.22.1
watch kubectl get pods -n calico-system
安装参考:安装calico网络
安装helm
wget https://get.helm.sh/helm-v3.6.1-linux-amd64.tar.gz
tar xf helm-v3.6.1-linux-amd64.tar.gz
mv linux-amd64/helm /usr/bin/
MetalLB
方式1: 导入yaml文件
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml
方式2: helm
helm repo add metallb https://metallb.github.io/metallb
helm install metallb metallb/metallb
# helm install metallb metallb/metallb -f values.yaml
导入配置
kubectl apply -f -<<EOF
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
# 注意修改IP地址段
- 20.88.9.100-20.88.9.200
EOF
Ingress
kubectl apply方式
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
helm安装方式
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace
第三方镜像库(helm)安装
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-release bitnami/nginx-ingress-controller
# Read more about the installation in the NGINX Ingress Controller packaged by Bitnami Chart Github repository
安装完成后,会输出对应的提示,然后执行命令
kubectl get --namespace ingress-nginx svc -w ingress-nginx-ingress-controller
执行后会输出一个Service.我的Service绑定了一个LoadBalancer地址,所以将所有域名解析到这个IP.
获取ingress监听得IP地址:
export SERVICE_IP=$(kubectl get svc --namespace ingress-nginx ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "Visit http://${SERVICE_IP} to access your application via HTTP."
echo "Visit https://${SERVICE_IP} to access your application via HTTPS."
检查
kubectl get pods --namespace=ingress-nginx