Skip to Main Content

k8s Related Usage

k8 installation

Install via KubeKey

kubekey

# 	Kubernetes 版本 ≥ 1.18
# socat	必须安装
# conntrack	必须安装
# 验证: socat -V && conntrack --version
sudo apt install socat conntrack -y


# 使用脚本获取 KubeKey
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | sh -
# 创建集群(快速开始)
export KKZONE=cn
# ./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
# 使用默认版本创建一个纯 Kubernetes 集群
./kk create cluster
# 创建一个部署了 KubeSphere 的 Kubernetes 集群 (例如 --with-kubesphere v3.1.0)
./kk create cluster --with-kubesphere
# 使用配置文件创建集群
./kk create cluster -f ~/myfolder/config-sample.yaml


# Console: http://10.0.16.146:30880
# Account: admin
# Password: P@88w0rd

# Please check the result using the command:
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f


# 删除集群
./kk delete cluster
# 有时候可能还需要主动删除这个文件夹
rm -rf /etc/kubernetes/

Problem

# FATA[0000] validate service connection: validate CRI v1 image API for endpoint "unix://run/containerd/containerd.sock": rpc error: code = Unimplemented desc = unknown service runtime.v1. mageService: Process Excludes with status 1

vi /etc/containerd/config. oml

# disabled_plugins = []# Ensure CRI
# Restart Containerd:
sudo systemctl start containerd


## /etc/etc/etcd. nv (this file may need to be created manually) (file in the current document directory)

# Certificate question
sudo mkdir -p /etc/ssl/certs
sudo chmod 755 /etc/ssl/certs
apt update && sudo apt install ca-certificates
sudo update-ca-certificates
## If docker is used, then you may need to restart docker (systemctl restart docker)

Install via RKE

官方文档

Install via KuboardSpray

官网地址

# 进入指定目录
cd /data/docker/k8s
# 快速安装
docker run -d \
  --dns=223.5.5.5 \
  --privileged \
  --restart=unless-stopped \
  --name=kuboard-spray \
  -p 80:80/tcp \
  -e TZ=Asia/Shanghai \
  -e https_proxy=http://10.0.16.17:7890 \
  -e http_proxy=http://10.0.16.17:7890 \
  -e all_proxy=socks5://10.0.16.17:7890 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/kuboard-spray-data:/data \
  eipwork/kuboard-spray:latest-amd64
# 在浏览器地址栏中输入 http://这台机器的IP地址,输入用户名 admin,默认密码 Kuboard123
docker run -d \
  --dns=223.5.5.5 \
  --privileged \
  --restart=unless-stopped \
  --name=kuboard-spray \
  -p 80:80/tcp \
  -e TZ=Asia/Shanghai \
  -v /var/run/docker.sock:/var/run/docker.sock \
  eipwork/kuboard-spray:latest-amd64

yum installation k8s

helm command

# Install
brew install helm

# Use

# to install
help install my-release skywalking -n <namespace>
# View list
helm list
# Uninstall
$ help uninstall my-release -n <namespace>

minikube

# Installation (needs to rely on docker)
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
# Please note that this method will continue to run minikube with root permission, but it may pose security risks because the "docker" driver should not be used as root.
minikube start--force
# Dashboard
minikuku dashboard

kuboard visualization interface

# KUBOARD_ENDPOINT="http://内网IP:80"
docker run -d \
  --restart=unless-stopped \
  --name=kuboard \
  -p 80:80/tcp \
  -p 10081:10081/tcp \
  -e KUBOARD_ENDPOINT="http://10.0.16.17:80" \
  -e KUBOARD_AGENT_SERVER_TCP_PORT="10081" \
  -v /root/kuboard-data:/data \
  eipwork/kuboard:v3
  • kubectl installation
# Deployment
kubectl app -f https://addons.kuboard.cn/kuboard/kuboard-v3.yaml
# See
kubectl get Methods -n kuboard
Uninstall #
kubectl ete -f https://addons. uboard.cn/kuboard-v3.yaml
  # Cleanup legacy
    # in master node and k8s.kuboard. n/role=etcd tag executes
rm -rf /usr/share/kuboard

---

## FAQ
# View Node
kubectl get nodes
# Headed
kubectl label nodes docker-desktop k8. uboard. n/role=etcd

----

## Visit Kuboard
# Open link http://your-node-ip-address:30080(eg: http://localhost:30080)
# Enter initial username and password, Login to
# Username: admin
# Password: Kuboard123

v4 Installation

官方快速开始页面