kubenetes and Centos 7 常见脚本

安装 salt

yum install -y https://mirrors.aliyun.com/epel/7/ppc64/Packages/s/salt-ssh-2015.5.10-2.el7.noarch.rpm \
https://mirrors.aliyun.com/epel/7/ppc64/Packages/s/salt-2015.5.10-2.el7.noarch.rpm

安装 helm

wget https://www.4wei.cn/files/helm-v3.9.2-linux-amd64.tar.gz
gunzip helm-v3.9.2-linux-amd64.tar.gz
tar -xf helm-v3.9.2-linux-amd64.tar
mv linux-amd64/helm /usr/local/bin/
chmod +x /usr/local/bin/helm

安装 Kuboard (内建用户)

使用 Docker 安装

docker run -d \
  --restart=unless-stopped \
  --name=kuboard \
  -p 80:80/tcp \
  -p 10081:10081/tcp \
  -e KUBOARD_ENDPOINT="http://内网IP:80" \
  -e KUBOARD_AGENT_SERVER_TCP_PORT="10081" \
  -v /root/kuboard-data:/data \
  eipwork/kuboard:v3

使用 k8s 安装

apiVersion: v1
kind: Namespace
metadata:
  name: kuboard
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations: {}
  labels:
    k8s.kuboard.cn/layer: cloud
    k8s.kuboard.cn/name: kuboard
  name: kuboard
  namespace: kuboard
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s.kuboard.cn/layer: cloud
      k8s.kuboard.cn/name: kuboard
  template:
    metadata:
      labels:
        k8s.kuboard.cn/layer: cloud
        k8s.kuboard.cn/name: kuboard
    spec:
      containers:
        - env:
            - name: KUBOARD_ENDPOINT
              value: 'http://{{改成你的节点IP}}:10080'
          envFrom: []
          image: 'swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard:v3'
          name: kuboard
          ports:
            - containerPort: 80
              hostPort: 10080
              name: kuboard
            - containerPort: 10081
              hostPort: 10081
              name: tcp
          resources:
            limits:
              cpu: '8'
              memory: 32000Mi
            requests:
              cpu: '2'
              memory: 4000Mi
          volumeMounts:
            - mountPath: /data
              name: volume-hostpath
      initContainers: []
      nodeName: {{改成你的节点名称}}
      volumes:
        - hostPath:
            path: /usr/share/kuboard
            type: DirectoryOrCreate
          name: volume-hostpath

安装 apisix

helm repo add apisix https://charts.apiseven.com
helm repo add bitnami https://charts.bitnami.com/bitnami

kubectl create ns ingress-apisix
helm install apisix apisix/apisix \
  --set gateway.type=NodePort \
  --set ingress-controller.enabled=true \
  --namespace ingress-apisix \
  --set ingress-controller.config.apisix.serviceNamespace=ingress-apisix

#可选参数
#--set persistence.storageClass=nfs

helm install apisix-dashboard apisix/apisix-dashboard --namespace ingress-apisix

kubectl create ns kubeapps
helm install kubeapps bitnami/kubeapps --namespace kubeapps

发表评论