编译Kubemark
背景
Kubemark是k8s虚拟化节点的工具,用于测试。
目前找不到现成可用Kubamark镜像,所以自行编译。
安装
yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake yum -y install wget httpd-tools vim yum -y install glibc-static.x86_64 yum -y install binutils
|
Go环境准备:
LInuxGo部署过程
源码构建:
yum install -y git
git clone https://github.com/kubernetes/kubernetes.git
git branch -a
git checkout -f remotes/origin/release-1.24
make WHAT='cmd/kubemark'
cp _output/bin/kubemark cluster/images/kubemark/ cd cluster/images/kubemark/
vim Dockerfile
make build
|
部署节点:
按照官网会出现缺少sh、bash的错误,因为google基础镜像没有这些
先给需要work节点打上label
kubectl label node kubemark=work
|
hollow-node_simplified_template.yaml:
apiVersion: v1 kind: ReplicationController metadata: name: hollow-node namespace: kubemark spec: replicas: 50 selector: name: hollow-node template: metadata: labels: name: hollow-node spec: nodeSelector: kubemark: work initContainers: - name: init-inotify-limit image: docker.io/busybox:latest imagePullPolicy: IfNotPresent command: ['sysctl', '-w', 'fs.inotify.max_user_instances=200'] securityContext: privileged: true volumes: - name: rci-volume hostPath: path: /run/containerd - name: kubeconfig-volume secret: secretName: kubeconfig - name: logs-volume hostPath: path: /var/log containers: - name: hollow-kubelet image: piwriw/kubemark:v1.21 imagePullPolicy: IfNotPresent ports: - containerPort: 4194 - containerPort: 10250 - containerPort: 10255 env: - name: NODE_NAME valueFrom: fieldRef: fieldPath: metadata.name command: - /kubemark args: - --morph=kubelet - --name=$(NODE_NAME) - --kubeconfig=/kubeconfig/kubelet.kubeconfig - --alsologtostderr - --v=2 volumeMounts: - name: rci-volume mountPath: /run/containerd - name: kubeconfig-volume mountPath: /kubeconfig readOnly: true - name: logs-volume mountPath: /var/log resources: requests:
memory: 50M securityContext: privileged: true - name: hollow-proxy image: piwriw/kubemark:v1.21 imagePullPolicy: IfNotPresent env: - name: NODE_NAME valueFrom: fieldRef: fieldPath: metadata.name command: - /kubemark args: - --morph=proxy - --name=$(NODE_NAME) - --use-real-proxier=false - --kubeconfig=/kubeconfig/kubeproxy.kubeconfig - --alsologtostderr - --v=2 volumeMounts: - name: kubeconfig-volume mountPath: /kubeconfig readOnly: true - name: logs-volume mountPath: /var/log resources: requests:
memory: 50M tolerations: - effect: NoExecute key: node.kubernetes.io/unreachable operator: Exists - effect: NoExecute key: node.kubernetes.io/not-ready operator: Exists
|
问题 rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.ImageService
cat > /etc/containerd/config.toml <<EOF [plugins."io.containerd.grpc.v1.cri"] systemd_cgroup = true EOF
systemctl restart containerd
|