K8S 클 러 스 터 설치 배포 연산 노드 서비스 -- kubelet
5680 단어 K8SK8S&Docker
200 certs]# vi kubelet-csr.json
{
"CN": "k8s-kubelet",
"hosts": [
"127.0.0.1",
"10.4.7.10",
"10.3.153.221",
"10.3.153.222"
],
"key": {
"algo": "rsa",
"size": 2048
},
"names": [
{
"C": "CN",
"ST": "beijing",
"L": "beijing",
"O": "od",
"OU": "ops"
}
]
}
200 certs]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server kubelet-csr.json | cfssl-json -bare kubelet
[root@test-operator certs]# ll | grep kubelet
-rw-r--r-- 1 root root 1115 Feb 1 08:14 kubelet.csr
-rw-r--r-- 1 root root 464 Feb 1 08:14 kubelet-csr.json
-rw------- 1 root root 1679 Feb 1 08:14 kubelet-key.pem
-rw-r--r-- 1 root root 1468 Feb 1 08:14 kubelet.pem
2. nodes 서버 두 대 에 kubelet 서 비 스 를 설치 합 니 다.
# ,221/222
cert]# cd /opt/kubernetes/server/bin/cert/
cert]# scp 10.3.153.200:/opt/certs/kubelet.pem .
cert]# scp 10.3.153.200:/opt/certs/kubelet-key.pem .
# 221
cert]# cd ../conf/
conf]# kubectl config set-cluster myk8s \
--certificate-authority=/opt/kubernetes/server/bin/cert/ca.pem \
--embed-certs=true \
--server=https://10.3.153.240:7443 \
--kubeconfig=kubelet.kubeconfig
conf]# kubectl config set-credentials k8s-node \
--client-certificate=/opt/kubernetes/server/bin/cert/client.pem \
--client-key=/opt/kubernetes/server/bin/cert/client-key.pem \
--embed-certs=true \
--kubeconfig=kubelet.kubeconfig
conf]# kubectl config set-context myk8s-context \
--cluster=myk8s \
--user=k8s-node \
--kubeconfig=kubelet.kubeconfig
conf]# kubectl config use-context myk8s-context --kubeconfig=kubelet.kubeconfig
conf]# vi k8s-node.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: k8s-node
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:node
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: k8s-node
conf]# kubectl create -f k8s-node.yaml
conf]# kubectl get clusterrolebinding k8s-node -o yaml
# 222
cert]# cd ../conf/
conf]# scp 10.3.153.221:/opt/kubernetes/server/bin/conf/kubelet.kubeconfig . #
~~~
~~~
# pause ,200 :
certs]# docker pull kubernetes/pause
certs]# docker tag f9d5de079539 harbor.od.com/public/pause:latest
certs]# docker push test-harbor.cedarhd.com/public/pause:latest
~~~
~~~
# 221/221 , ,
bin]# vi /opt/kubernetes/server/bin/kubelet.sh
#!/bin/sh
./kubelet \
--anonymous-auth=false \
--cgroup-driver systemd \
--cluster-dns 192.168.0.2 \
--cluster-domain cluster.local \
--runtime-cgroups=/systemd/system.slice \
--kubelet-cgroups=/systemd/system.slice \
--fail-swap-on="false" \
--client-ca-file ./cert/ca.pem \
--tls-cert-file ./cert/kubelet.pem \
--tls-private-key-file ./cert/kubelet-key.pem \
--hostname-override test-nodes1.cedarhd.com.com \
--image-gc-high-threshold 20 \
--image-gc-low-threshold 10 \
--kubeconfig ./conf/kubelet.kubeconfig \
--log-dir /data/logs/kubernetes/kube-kubelet \
--pod-infra-container-image harbor.od.com/public/pause:latest \
--root-dir /data/kubelet
bin]# mkdir -p /data/logs/kubernetes/kube-kubelet /data/kubelet
bin]# chmod +x kubelet.sh
bin]# vi /etc/supervisord.d/kube-kubelet.ini
[program:kube-kubelet-7-21]
command=/opt/kubernetes/server/bin/kubelet.sh ; the program (relative uses PATH, can take args)
numprocs=1 ; number of processes copies to start (def 1)
directory=/opt/kubernetes/server/bin ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs=30 ; number of secs prog must stay running (def. 1)
startretries=3 ; max # of serial start failures (default 3)
exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
user=root ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/kubernetes/kube-kubelet/kubelet.stdout.log ; stderr log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=4 ; # of stdout logfile backups (default 10)
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
stdout_events_enabled=false ; emit events on stdout writes (default false)
bin]# supervisorctl update
bin]# supervisorctl status
[root@test-nodes1 etcd]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
test-nodes1.cedarhd.com Ready master,node 25h v1.15.2
test-nodes2.cedarhd.com Ready master,node 25h v1.15.2
# ,221/222 master,node
bin]# kubectl label node hdss7-21.host.com node-role.kubernetes.io/master=
bin]# kubectl get nodes
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Docker의 네 가지 네트워크 모델1. NAT(기본값) 2. None(네트워크 없음) 3. Host(호스트와 동일한 IP) 넷째, 연합 네트워크(즉 두 용기가 하나의 IP 주소를 공유함)...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.