1. [root@hs-k8s-master01 ~]# cd /data/
  2. [root@hs-k8s-master01 data]# ls
  3. docker
  4. [root@hs-k8s-master01 data]# mkdir k8s
  5. [root@hs-k8s-master01 data]# cd k8s/
  6. [root@hs-k8s-master01 k8s]# ls
  7. [root@hs-k8s-master01 k8s]# mkdir source_code
  8. [root@hs-k8s-master01 k8s]# cd source_code/
  9. [root@hs-k8s-master01 source_code]# rz
  10.  
  11. [root@hs-k8s-master01 source_code]# tar xf kubernetes-1.17..tar.gz
  12. [root@hs-k8s-master01 source_code]# ls
  13. kubernetes-1.17. kubernetes-1.17..tar.gz
  14. [root@hs-k8s-master01 source_code]# cd kubernetes-1.17./
  15. [root@hs-k8s-master01 kubernetes-1.17.]# ls
  16. api cluster Godeps logo pkg SUPPORT.md WORKSPACE
  17. build cmd go.mod Makefile plugin test
  18. BUILD.bazel code-of-conduct.md go.sum Makefile.generated_files README.md third_party
  19. CHANGELOG-1.17.md CONTRIBUTING.md hack OWNERS SECURITY_CONTACTS translations
  20. CHANGELOG.md docs LICENSE OWNERS_ALIASES staging vendor
  21. [root@hs-k8s-master01 kubernetes-1.17.]#
  22. [root@hs-k8s-master01 kubernetes-1.17.]# vim ./staging/src/k8s.io/c
  23. client-go/ cloud-provider/ code-generator/ cri-api/
  24. cli-runtime/ cluster-bootstrap/ component-base/ csi-translation-lib/
  25. [root@hs-k8s-master01 kubernetes-1.17.]# vim ./staging/src/k8s.io/cli
  26. client-go/ cli-runtime/
  27. [root@hs-k8s-master01 kubernetes-1.17.]# vim ./staging/src/k8s.io/client-go/util/cert
  28. cert/ certificate/
  29. [root@hs-k8s-master01 kubernetes-1.17.]# vim ./staging/src/k8s.io/client-go/util/cert/cert.go
  30. [root@hs-k8s-master01 kubernetes-1.17.]# vim ./cmd/kubeadm/app/util/pkiutil/pki_helpers.go
  31. [root@hs-k8s-master01 kubernetes-1.17.]# vim ./cmd/kubeadm/app/constants/constants.go
  32. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull mirrorgooglecontainers/kube-cross:v1.12.10-
  33. Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 223.5.5.5:53: read udp 10.0.0.200:37338->223.5.5.5:53: i/o timeout
  34. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull mirrorgooglecontainers/kube-cross:v1.12.10-
  35. Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 223.5.5.5:53: read udp 10.0.0.200:4029->223.5.5.5:53: i/o timeout
  36. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull gcrcontainer/kube-cross:v1.13.5-
  37. Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 223.5.5.5:53: read udp 10.0.0.200:59440->223.5.5.5:53: i/o timeout
  38. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-cross:v1.13.5-
  39. Error response from daemon: Get https://registry.cn-hangzhou.aliyuncs.com/v2/: dial tcp: lookup registry.cn-hangzhou.aliyuncs.com on 223.5.5.5:53: read udp 10.0.0.200:42909->223.5.5.5:53: i/o timeout
  40. [root@hs-k8s-master01 kubernetes-1.17.]# dig @114.114.114.114 registry-.docker.io
  41.  
  42. ; <<>> DiG 9.11.-P2-RedHat-9.11.-.P2.el7 <<>> @114.114.114.114 registry-.docker.io
  43. ; ( server found)
  44. ;; global options: +cmd
  45. ;; connection timed out; no servers could be reached
  46. [root@hs-k8s-master01 kubernetes-1.17.]# docker version
  47. Client: Docker Engine - Community
  48. Version: 19.03.
  49. API version: 1.40
  50. Go version: go1.12.12
  51. Git commit: 633a0ea
  52. Built: Wed Nov ::
  53. OS/Arch: linux/amd64
  54. Experimental: false
  55.  
  56. Server: Docker Engine - Community
  57. Engine:
  58. Version: 19.03.
  59. API version: 1.40 (minimum version 1.12)
  60. Go version: go1.12.10
  61. Git commit: a872fc2f86
  62. Built: Tue Oct ::
  63. OS/Arch: linux/amd64
  64. Experimental: false
  65. containerd:
  66. Version: 1.2.
  67. GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
  68. runc:
  69. Version: 1.0.-rc8+dev
  70. GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
  71. docker-init:
  72. Version: 0.18.
  73. GitCommit: fec3683
  74. [root@hs-k8s-master01 kubernetes-1.17.]# docker image ls
  75. REPOSITORY TAG IMAGE ID CREATED SIZE
  76. [root@hs-k8s-master01 kubernetes-1.17.]#
  77. [root@hs-k8s-master01 kubernetes-1.17.]# docekr search nginx
  78. -bash: docekr: 未找到命令
  79. [root@hs-k8s-master01 kubernetes-1.17.]# docker search nginx
  80. Error response from daemon: Get https://index.docker.io/v1/search?q=nginx&n=25: dial tcp: lookup index.docker.io on 223.5.5.5:53: read udp 10.0.0.200:15999->223.5.5.5:53: i/o timeout
  81. [root@hs-k8s-master01 kubernetes-1.17.]# mv /etc/sysconfig/network-scripts/ifcfg-eth1 /tmp/
  82. [root@hs-k8s-master01 kubernetes-1.17.]# systemctl restart network
  83. [root@hs-k8s-master01 kubernetes-1.17.]# hostname -I
  84. 20.0.0.200 172.17.0.1
  85. [root@hs-k8s-master01 kubernetes-1.17.]# docker search nginx
  86. Error response from daemon: Get https://index.docker.io/v1/search?q=nginx&n=25: dial tcp: lookup index.docker.io on 223.5.5.5:53: read udp 20.0.0.200:45441->223.5.5.5:53: i/o timeout
  87. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull nginx
  88. Using default tag: latest
  89. latest: Pulling from library/nginx
  90. bc51dd8edc1b: Downloading [=> ] .7kB/.09MB
  91. 66ba67045f57: Downloading [=> ] .7kB/.88MB
  92. bf317aa10aa5: Download complete
  93. ^C
  94. [root@hs-k8s-master01 kubernetes-1.17.]# docker image ls
  95. REPOSITORY TAG IMAGE ID CREATED SIZE
  96. [root@hs-k8s-master01 kubernetes-1.17.]#
  97. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull gccontainer/kube-cross:v1.13.5-
  98. Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 223.5.5.5:53: read udp 20.0.0.200:61687->223.5.5.5:53: i/o timeout
  99. [root@hs-k8s-master01 kubernetes-1.17.]# dig @114.114.114.114 registry-.docker.io
  100.  
  101. ; <<>> DiG 9.11.-P2-RedHat-9.11.-.P2.el7 <<>> @114.114.114.114 registry-.docker.io
  102. ; ( server found)
  103. ;; global options: +cmd
  104. ;; Got answer:
  105. ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:
  106. ;; flags: qr rd ra; QUERY: , ANSWER: , AUTHORITY: , ADDITIONAL:
  107.  
  108. ;; OPT PSEUDOSECTION:
  109. ; EDNS: version: , flags:; udp:
  110. ;; QUESTION SECTION:
  111. ;registry-.docker.io. IN A
  112.  
  113. ;; ANSWER SECTION:
  114. registry-.docker.io. IN A 34.197.189.129
  115. registry-.docker.io. IN A 34.228.211.243
  116. registry-.docker.io. IN A 34.199.77.19
  117. registry-.docker.io. IN A 3.226.66.79
  118. registry-.docker.io. IN A 34.201.196.144
  119. registry-.docker.io. IN A 34.232.31.24
  120. registry-.docker.io. IN A 34.199.40.84
  121. registry-.docker.io. IN A 3.224.75.242
  122.  
  123. ;; Query time: msec
  124. ;; SERVER: 114.114.114.114#(114.114.114.114)
  125. ;; WHEN: 2 :: CST
  126. ;; MSG SIZE rcvd:
  127.  
  128. [root@hs-k8s-master01 kubernetes-1.17.]# vim /etc/hosts
  129. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull gccontainer/kube-cross:v1.13.5-
  130. Error response from daemon: Get https://registry-1.docker.io/v2/gccontainer/kube-cross/manifests/v1.13.5-1: Get https://auth.docker.io/token?scope=repository%3Agccontainer%2Fkube-cross%3Apull&service=registry.docker.io: dial tcp: lookup auth.docker.io on 223.5.5.5:53: read udp 20.0.0.200:31167->223.5.5.5:53: i/o timeout
  131. [root@hs-k8s-master01 kubernetes-1.17.]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
  132. [root@hs-k8s-master01 kubernetes-1.17.]# systemctl restart network
  133. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull gccontainer/kube-cross:v1.13.5-
  134. Error response from daemon: pull access denied for gccontainer/kube-cross, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  135. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull gccontainer/kube-cross:v1.13.5
  136. Error response from daemon: pull access denied for gccontainer/kube-cross, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  137. [root@hs-k8s-master01 kubernetes-1.17.]# docker pull gcrcontainer/kube-cross:v1.13.5-
  138.  
  139. 查看网上的资料主要有两个地方需要修改
  140.  
  141. vim ./staging/src/k8s.io/client-go/util/cert/cert.go
  142. # 这个方法里面NotAfter: now.Add(duration365d * ).UTC()
  143. # 默认有效期就是10年,改成100年
  144. func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, error) {
  145. now := time.Now()
  146. tmpl := x509.Certificate{
  147. SerialNumber: new(big.Int).SetInt64(),
  148. Subject: pkix.Name{
  149. CommonName: cfg.CommonName,
  150. Organization: cfg.Organization,
  151. },
  152. NotBefore: now.UTC(),
  153. // NotAfter: now.Add(duration365d * 10).UTC(),
  154. NotAfter: now.Add(duration365d * ).UTC(),
  155. KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
  156. BasicConstraintsValid: true,
  157. IsCA: true,
  158. }
  159.  
  160. certDERBytes, err := x509.CreateCertificate(cryptorand.Reader, &tmpl, &tmpl, key.Public(), key)
  161. if err != nil {
  162. return nil, err
  163. }
  164. return x509.ParseCertificate(certDERBytes)
  165. }
  166.  
  167. vim ./cmd/kubeadm/app/util/pkiutil/pki_helpers.go
  168. # 这个方法里面看到NotAfter: time.Now().Add(kubeadmconstants.CertificateValidity).UTC()
  169. # 参数里面是一个常量kubeadmconstants.CertificateValidity
  170. # 所以这里可以不修改,我去看看源码能不能找到这个常量的赋值位置
  171. func NewSignedCert(cfg *certutil.Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error) { serial, err := cryptorand.Int(cryptorand.Reader, new(big.Int).SetInt64(math.MaxInt64))
  172. if err != nil {
  173. return nil, err
  174. }
  175. if len(cfg.CommonName) == {
  176. return nil, errors.New("must specify a CommonName")
  177. }
  178. if len(cfg.Usages) == {
  179. return nil, errors.New("must specify at least one ExtKeyUsage")
  180. }
  181.  
  182. certTmpl := x509.Certificate{
  183. Subject: pkix.Name{
  184. CommonName: cfg.CommonName,
  185. Organization: cfg.Organization,
  186. },
  187. DNSNames: cfg.AltNames.DNSNames,
  188. IPAddresses: cfg.AltNames.IPs,
  189. SerialNumber: serial,
  190. NotBefore: caCert.NotBefore,
  191. NotAfter: time.Now().Add(kubeadmconstants.CertificateValidity).UTC(),
  192. KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
  193. ExtKeyUsage: cfg.Usages,
  194. }
  195. certDERBytes, err := x509.CreateCertificate(cryptorand.Reader, &certTmpl, caCert, key.Public(), caKey)
  196. if err != nil {
  197. return nil, err
  198. }
  199. return x509.ParseCertificate(certDERBytes)
  200. }
  201. 结果在这里找到kubeadmconstants.CertificateValidity的定义
  202.  
  203. vim ./cmd/kubeadm/app/constants/constants.go
  204. // 就是这个常量定义CertificateValidity,我改成*100年
  205. const (
  206. // KubernetesDir is the directory Kubernetes owns for storing various configuration files
  207. KubernetesDir = "/etc/kubernetes"
  208. // ManifestsSubDirName defines directory name to store manifests
  209. ManifestsSubDirName = "manifests"
  210. // TempDirForKubeadm defines temporary directory for kubeadm
  211. // should be joined with KubernetesDir.
  212. TempDirForKubeadm = "tmp"
  213.  
  214. // CertificateValidity defines the validity for all the signed certificates generated by kubeadm
  215. // CertificateValidity = time.Hour * 24 * 365
  216. CertificateValidity = time.Hour * * *
  217.  
  218. // CACertAndKeyBaseName defines certificate authority base name
  219. CACertAndKeyBaseName = "ca"
  220. // CACertName defines certificate name
  221. CACertName = "ca.crt"
  222. // CAKeyName defines certificate name
  223. CAKeyName = "ca.key"
  224. 源代码改好了,接下来就是编译kubeadm
  225.  
  226. [root@hs-k8s-master01 ~]# kubeadm alpha certs check-expiration
  227. [check-expiration] Reading configuration from the cluster...
  228. [check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
  229.  
  230. CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
  231. admin.conf Feb , : UTC 364d no
  232. apiserver Feb , : UTC 364d ca no
  233. apiserver-etcd-client Feb , : UTC 364d etcd-ca no
  234. apiserver-kubelet-client Feb , : UTC 364d ca no
  235. controller-manager.conf Feb , : UTC 364d no
  236. etcd-healthcheck-client Feb , : UTC 364d etcd-ca no
  237. etcd-peer Feb , : UTC 364d etcd-ca no
  238. etcd-server Feb , : UTC 364d etcd-ca no
  239. front-proxy-client Feb , : UTC 364d front-proxy-ca no
  240. scheduler.conf Feb , : UTC 364d no
  241.  
  242. CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
  243. ca Jan , : UTC 9y no
  244. etcd-ca Jan , : UTC 9y no
  245. front-proxy-ca Jan , : UTC 9y no
  246.  
  247. [root@hs-k8s-master01 ~]# cd /data/k8s/
  248. [root@hs-k8s-master01 k8s]# ls
  249. source_code yaml
  250. [root@hs-k8s-master01 k8s]# cd source_code/
  251. [root@hs-k8s-master01 source_code]# ls
  252. kubernetes-1.17. kubernetes-1.17..tar.gz
  253. [root@hs-k8s-master01 source_code]# cd kubernetes-1.17./
  254. [root@hs-k8s-master01 kubernetes-1.17.]# ls
  255. api cluster Godeps logo OWNERS_ALIASES staging vendor
  256. build cmd go.mod Makefile pkg SUPPORT.md WORKSPACE
  257. BUILD.bazel code-of-conduct.md go.sum Makefile.generated_files plugin test
  258. CHANGELOG-1.17.md CONTRIBUTING.md hack _output README.md third_party
  259. CHANGELOG.md docs LICENSE OWNERS SECURITY_CONTACTS translations
  260. [root@hs-k8s-master01 kubernetes-1.17.]# cd _output/
  261. [root@hs-k8s-master01 _output]# ls
  262. APIEXTENSIONS_violations.report bin CODEGEN_violations.report KUBE_violations.report local SAMPLEAPISERVER_violations.report
  263. [root@hs-k8s-master01 _output]# ll
  264. 总用量
  265. -rw-r--r-- root root 2 : APIEXTENSIONS_violations.report
  266. lrwxrwxrwx root root 2 : bin -> /go/src/k8s.io/kubernetes/_output/local/bin/linux/amd64
  267. -rw-r--r-- root root 2 : CODEGEN_violations.report
  268. -rw-r--r-- root root 2 : KUBE_violations.report
  269. drwxr-xr-x root root 2 : local
  270. -rw-r--r-- root root 2 : SAMPLEAPISERVER_violations.report
  271. [root@hs-k8s-master01 _output]# cd local/
  272. [root@hs-k8s-master01 local]# ls
  273. bin go
  274. [root@hs-k8s-master01 local]# cd bin/
  275. [root@hs-k8s-master01 bin]# ls
  276. linux
  277. [root@hs-k8s-master01 bin]# cd linux/
  278. [root@hs-k8s-master01 linux]# ls
  279. amd64
  280. [root@hs-k8s-master01 linux]# cd amd64/
  281. [root@hs-k8s-master01 amd64]# ls
  282. conversion-gen deepcopy-gen defaulter-gen go2make go-bindata kubeadm openapi-gen
  283. [root@hs-k8s-master01 amd64]#
  284. [root@hs-k8s-master01 amd64]# cd ../../
  285. [root@hs-k8s-master01 bin]# ls
  286. linux
  287. [root@hs-k8s-master01 bin]# cd ../
  288. [root@hs-k8s-master01 local]# ls
  289. bin go
  290. [root@hs-k8s-master01 local]# cd ..
  291. [root@hs-k8s-master01 _output]# ls
  292. APIEXTENSIONS_violations.report bin CODEGEN_violations.report KUBE_violations.report local SAMPLEAPISERVER_violations.report
  293. [root@hs-k8s-master01 _output]# cd ..
  294. [root@hs-k8s-master01 kubernetes-1.17.]# ls
  295. api cluster Godeps logo OWNERS_ALIASES staging vendor
  296. build cmd go.mod Makefile pkg SUPPORT.md WORKSPACE
  297. BUILD.bazel code-of-conduct.md go.sum Makefile.generated_files plugin test
  298. CHANGELOG-1.17.md CONTRIBUTING.md hack _output README.md third_party
  299. CHANGELOG.md docs LICENSE OWNERS SECURITY_CONTACTS translations
  300. [root@hs-k8s-master01 kubernetes-1.17.]# cp /usr/bin/kubeadm{,.bak}
  301. [root@hs-k8s-master01 kubernetes-1.17.]# cp _output/local/bin/linux/amd64/kubeadm
  302. [root@hs-k8s-master01 kubernetes-1.17.]# cp _output/local/bin/linux/amd64/kubeadm /usr/bin/kubeadm
  303. cp:是否覆盖"/usr/bin/kubeadm" y
  304. [root@hs-k8s-master01 kubernetes-1.17.]# cd /etc/kubernetes/pki/
  305. [root@hs-k8s-master01 pki]# ls
  306. apiserver.crt apiserver.key ca.crt front-proxy-ca.crt front-proxy-client.key
  307. apiserver-etcd-client.crt apiserver-kubelet-client.crt ca.key front-proxy-ca.key sa.key
  308. apiserver-etcd-client.key apiserver-kubelet-client.key etcd front-proxy-client.crt sa.pub
  309. [root@hs-k8s-master01 pki]# cd ..
  310. [root@hs-k8s-master01 kubernetes]# ls
  311. admin.conf controller-manager.conf gcrcontainer-kube-cross:v1.13.5-.tar kubelet.conf manifests pki scheduler.conf
  312. [root@hs-k8s-master01 kubernetes]# ll
  313. 总用量
  314. -rw------- root root 2 : admin.conf
  315. -rw------- root root 2 : controller-manager.conf
  316. -rw-r--r-- root root 2 : gcrcontainer-kube-cross:v1.13.5-.tar
  317. -rw------- root root 2 : kubelet.conf
  318. drwxr-xr-x root root 2 : manifests
  319. drwxr-xr-x root root 2 : pki
  320. -rw------- root root 2 : scheduler.conf
  321. [root@hs-k8s-master01 kubernetes]# rm -f gcrcontainer-kube-cross\:v1.13.5-.tar
  322. [root@hs-k8s-master01 kubernetes]# ls
  323. admin.conf controller-manager.conf kubelet.conf manifests pki scheduler.conf
  324. [root@hs-k8s-master01 kubernetes]#
  325. [root@hs-k8s-master01 kubernetes]# ll
  326. 总用量
  327. -rw------- root root 2 : admin.conf
  328. -rw------- root root 2 : controller-manager.conf
  329. -rw------- root root 2 : kubelet.conf
  330. drwxr-xr-x root root 2 : manifests
  331. drwxr-xr-x root root 2 : pki
  332. -rw------- root root 2 : scheduler.conf
  333. [root@hs-k8s-master01 kubernetes]# mkdir pki.bak
  334. [root@hs-k8s-master01 kubernetes]# ll
  335. 总用量
  336. -rw------- root root 2 : admin.conf
  337. -rw------- root root 2 : controller-manager.conf
  338. -rw------- root root 2 : kubelet.conf
  339. drwxr-xr-x root root 2 : manifests
  340. drwxr-xr-x root root 2 : pki
  341. drwxr-xr-x root root 2 : pki.bak
  342. -rw------- root root 2 : scheduler.conf
  343. [root@hs-k8s-master01 kubernetes]# vm pki/* pki.bak/
  344. -bash: vm: 未找到命令
  345. [root@hs-k8s-master01 kubernetes]# mv pki/* pki.bak/
  346. [root@hs-k8s-master01 kubernetes]# ll
  347. 总用量 32
  348. -rw------- 1 root root 5450 2月 3 15:17 admin.conf
  349. -rw------- 1 root root 5482 2月 3 15:17 controller-manager.conf
  350. -rw------- 1 root root 1894 2月 3 15:17 kubelet.conf
  351. drwxr-xr-x 2 root root 113 2月 3 15:17 manifests
  352. drwxr-xr-x 2 root root 6 2月 3 16:57 pki
  353. drwxr-xr-x 3 root root 4096 2月 3 16:57 pki.bak
  354. -rw------- 1 root root 5430 2月 3 15:17 scheduler.conf
  355. [root@hs-k8s-master01 kubernetes]#
  356. [root@hs-k8s-master01 kubernetes]# cd pki
  357. [root@hs-k8s-master01 pki]# ls
  358. [root@hs-k8s-master01 pki]# cd ..
  359. [root@hs-k8s-master01 kubernetes]# kubeadm alpha certs renew all
  360. [renew] Reading configuration from the cluster...
  361. [renew] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
  362.  
  363. Error checking external CA condition for ca certificate authority: failure loading certificate for CA: couldn't load the certificate file /etc/kubernetes/pki/ca.crt: open /etc/kubernetes/pki/ca.crt: no such file or directory
  364. To see the stack trace of this error execute with --v=5 or higher
  365. [root@hs-k8s-master01 kubernetes]# ll
  366. 总用量 32
  367. -rw------- 1 root root 5450 2月 3 15:17 admin.conf
  368. -rw------- 1 root root 5482 2月 3 15:17 controller-manager.conf
  369. -rw------- 1 root root 1894 2月 3 15:17 kubelet.conf
  370. drwxr-xr-x 2 root root 113 2月 3 15:17 manifests
  371. drwxr-xr-x 2 root root 6 2月 3 16:57 pki
  372. drwxr-xr-x 3 root root 4096 2月 3 16:57 pki.bak
  373. -rw------- 1 root root 5430 2月 3 15:17 scheduler.conf
  374. [root@hs-k8s-master01 kubernetes]# cp pki.bak/* pki/
  375. cp: 略过目录"pki.bak/etcd"
  376. [root@hs-k8s-master01 kubernetes]# ll
  377. 总用量 36
  378. -rw------- 1 root root 5450 2月 3 15:17 admin.conf
  379. -rw------- 1 root root 5482 2月 3 15:17 controller-manager.conf
  380. -rw------- 1 root root 1894 2月 3 15:17 kubelet.conf
  381. drwxr-xr-x 2 root root 113 2月 3 15:17 manifests
  382. drwxr-xr-x 2 root root 4096 2月 3 16:58 pki
  383. drwxr-xr-x 3 root root 4096 2月 3 16:57 pki.bak
  384. -rw------- 1 root root 5430 2月 3 15:17 scheduler.conf
  385. [root@hs-k8s-master01 kubernetes]# cd pki
  386. [root@hs-k8s-master01 pki]# ls
  387. apiserver.crt apiserver.key ca.crt front-proxy-ca.key sa.key
  388. apiserver-etcd-client.crt apiserver-kubelet-client.crt ca.key front-proxy-client.crt sa.pub
  389. apiserver-etcd-client.key apiserver-kubelet-client.key front-proxy-ca.crt front-proxy-client.key
  390. [root@hs-k8s-master01 pki]# cd ..
  391. [root@hs-k8s-master01 kubernetes]# ls
  392. admin.conf controller-manager.conf kubelet.conf manifests pki pki.bak scheduler.conf
  393. [root@hs-k8s-master01 kubernetes]# cd pki.bak/
  394. [root@hs-k8s-master01 pki.bak]# ls
  395. apiserver.crt apiserver.key ca.crt front-proxy-ca.crt front-proxy-client.key
  396. apiserver-etcd-client.crt apiserver-kubelet-client.crt ca.key front-proxy-ca.key sa.key
  397. apiserver-etcd-client.key apiserver-kubelet-client.key etcd front-proxy-client.crt sa.pub
  398. [root@hs-k8s-master01 pki.bak]# cd etcd/
  399. [root@hs-k8s-master01 etcd]# ls
  400. ca.crt ca.key healthcheck-client.crt healthcheck-client.key peer.crt peer.key server.crt server.key
  401. [root@hs-k8s-master01 etcd]# cd ..
  402. [root@hs-k8s-master01 pki.bak]# cd ..
  403. [root@hs-k8s-master01 kubernetes]# cd pki
  404. [root@hs-k8s-master01 pki]# ll
  405. 总用量 56
  406. -rw-r--r-- 1 root root 1241 2月 3 16:58 apiserver.crt
  407. -rw-r--r-- 1 root root 1090 2月 3 16:58 apiserver-etcd-client.crt
  408. -rw------- 1 root root 1675 2月 3 16:58 apiserver-etcd-client.key
  409. -rw------- 1 root root 1675 2月 3 16:58 apiserver.key
  410. -rw-r--r-- 1 root root 1099 2月 3 16:58 apiserver-kubelet-client.crt
  411. -rw------- 1 root root 1675 2月 3 16:58 apiserver-kubelet-client.key
  412. -rw-r--r-- 1 root root 1025 2月 3 16:58 ca.crt
  413. -rw------- 1 root root 1675 2月 3 16:58 ca.key
  414. -rw-r--r-- 1 root root 1038 2月 3 16:58 front-proxy-ca.crt
  415. -rw------- 1 root root 1679 2月 3 16:58 front-proxy-ca.key
  416. -rw-r--r-- 1 root root 1058 2月 3 16:58 front-proxy-client.crt
  417. -rw------- 1 root root 1679 2月 3 16:58 front-proxy-client.key
  418. -rw------- 1 root root 1675 2月 3 16:58 sa.key
  419. -rw------- 1 root root 451 2月 3 16:58 sa.pub
  420. [root@hs-k8s-master01 pki]# mkdir etcd
  421. [root@hs-k8s-master01 pki]# cd ..
  422. [root@hs-k8s-master01 kubernetes]# cd pki.bak/
  423. [root@hs-k8s-master01 pki.bak]# mv etcd/* ../pki/etcd/
  424. [root@hs-k8s-master01 pki.bak]# cd ..
  425. [root@hs-k8s-master01 kubernetes]# ll
  426. 总用量 36
  427. -rw------- 1 root root 5450 2月 3 15:17 admin.conf
  428. -rw------- 1 root root 5482 2月 3 15:17 controller-manager.conf
  429. -rw------- 1 root root 1894 2月 3 15:17 kubelet.conf
  430. drwxr-xr-x 2 root root 113 2月 3 15:17 manifests
  431. drwxr-xr-x 3 root root 4096 2月 3 16:59 pki
  432. drwxr-xr-x 3 root root 4096 2月 3 16:57 pki.bak
  433. -rw------- 1 root root 5430 2月 3 15:17 scheduler.conf
  434. [root@hs-k8s-master01 kubernetes]# cd pki
  435. [root@hs-k8s-master01 pki]# ll
  436. 总用量 56
  437. -rw-r--r-- 1 root root 1241 2月 3 16:58 apiserver.crt
  438. -rw-r--r-- 1 root root 1090 2月 3 16:58 apiserver-etcd-client.crt
  439. -rw------- 1 root root 1675 2月 3 16:58 apiserver-etcd-client.key
  440. -rw------- 1 root root 1675 2月 3 16:58 apiserver.key
  441. -rw-r--r-- 1 root root 1099 2月 3 16:58 apiserver-kubelet-client.crt
  442. -rw------- 1 root root 1675 2月 3 16:58 apiserver-kubelet-client.key
  443. -rw-r--r-- 1 root root 1025 2月 3 16:58 ca.crt
  444. -rw------- 1 root root 1675 2月 3 16:58 ca.key
  445. drwxr-xr-x 2 root root 162 2月 3 16:59 etcd
  446. -rw-r--r-- 1 root root 1038 2月 3 16:58 front-proxy-ca.crt
  447. -rw------- 1 root root 1679 2月 3 16:58 front-proxy-ca.key
  448. -rw-r--r-- 1 root root 1058 2月 3 16:58 front-proxy-client.crt
  449. -rw------- 1 root root 1679 2月 3 16:58 front-proxy-client.key
  450. -rw------- 1 root root 1675 2月 3 16:58 sa.key
  451. -rw------- 1 root root 451 2月 3 16:58 sa.pub
  452. [root@hs-k8s-master01 pki]# kubeadm alpha certs renew all
  453. [renew] Reading configuration from the cluster...
  454. [renew] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
  455.  
  456. certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself renewed
  457. certificate for serving the Kubernetes API renewed
  458. certificate the apiserver uses to access etcd renewed
  459. certificate for the API server to connect to kubelet renewed
  460. certificate embedded in the kubeconfig file for the controller manager to use renewed
  461. certificate for liveness probes to healthcheck etcd renewed
  462. certificate for etcd nodes to communicate with each other renewed
  463. certificate for serving etcd renewed
  464. certificate for the front proxy client renewed
  465. certificate embedded in the kubeconfig file for the scheduler manager to use renewed
  466. [root@hs-k8s-master01 pki]# kubeadm alpha certs check-expiration
  467. [check-expiration] Reading configuration from the cluster...
  468. [check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
  469.  
  470. CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
  471. admin.conf Jan 10, 2120 08:59 UTC 99y no
  472. apiserver Jan 10, 2120 08:59 UTC 99y ca no
  473. apiserver-etcd-client Jan 10, 2120 08:59 UTC 99y etcd-ca no
  474. apiserver-kubelet-client Jan 10, 2120 08:59 UTC 99y ca no
  475. controller-manager.conf Jan 10, 2120 08:59 UTC 99y no
  476. etcd-healthcheck-client Jan 10, 2120 08:59 UTC 99y etcd-ca no
  477. etcd-peer Jan 10, 2120 08:59 UTC 99y etcd-ca no
  478. etcd-server Jan 10, 2120 08:59 UTC 99y etcd-ca no
  479. front-proxy-client Jan 10, 2120 08:59 UTC 99y front-proxy-ca no
  480. scheduler.conf Jan 10, 2120 08:59 UTC 99y no
  481.  
  482. CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
  483. ca Jan 31, 2030 07:17 UTC 9y no
  484. etcd-ca Jan 31, 2030 07:17 UTC 9y no
  485. front-proxy-ca Jan 31, 2030 07:17 UTC 9y no
  486.  
  487. [root@bs-k8s-master02 ~]# cp /usr/bin/kubeadm{,.bak}
  488. [root@hs-k8s-master01 pki]# scp /usr/bin/kubeadm 20.0.0.201:/usr/bin/kubeadm
  489. [root@bs-k8s-master02 ~]# kubeadm alpha certs renew all
  490. [renew] Reading configuration from the cluster...
  491. [renew] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
  492.  
  493. certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself renewed
  494. certificate for serving the Kubernetes API renewed
  495. certificate the apiserver uses to access etcd renewed
  496. certificate for the API server to connect to kubelet renewed
  497. certificate embedded in the kubeconfig file for the controller manager to use renewed
  498. certificate for liveness probes to healthcheck etcd renewed
  499. certificate for etcd nodes to communicate with each other renewed
  500. certificate for serving etcd renewed
  501. certificate for the front proxy client renewed
  502. certificate embedded in the kubeconfig file for the scheduler manager to use renewed
  503. [root@bs-k8s-master02 ~]# kubeadm alpha certs check-expiration
  504. [check-expiration] Reading configuration from the cluster...
  505. [check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
  506.  
  507. CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
  508. admin.conf Jan 10, 2120 09:03 UTC 99y no
  509. apiserver Jan 10, 2120 09:03 UTC 99y ca no
  510. apiserver-etcd-client Jan 10, 2120 09:03 UTC 99y etcd-ca no
  511. apiserver-kubelet-client Jan 10, 2120 09:03 UTC 99y ca no
  512. controller-manager.conf Jan 10, 2120 09:03 UTC 99y no
  513. etcd-healthcheck-client Jan 10, 2120 09:03 UTC 99y etcd-ca no
  514. etcd-peer Jan 10, 2120 09:04 UTC 99y etcd-ca no
  515. etcd-server Jan 10, 2120 09:04 UTC 99y etcd-ca no
  516. front-proxy-client Jan 10, 2120 09:04 UTC 99y front-proxy-ca no
  517. scheduler.conf Jan 10, 2120 09:04 UTC 99y no
  518.  
  519. CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
  520. ca Jan 31, 2030 07:17 UTC 9y no
  521. etcd-ca Jan 31, 2030 07:17 UTC 9y no
  522. front-proxy-ca Jan 31, 2030 07:17 UTC 9y no
  523.  
  524. 同理 master03

kubernetes 1.17.2 kubeadm部署 证书修改为100年的更多相关文章

  1. 使用kubernetes 官网工具kubeadm部署kubernetes(使用阿里云镜像)

    系列目录 kubernetes简介 Kubernetes节点架构图: kubernetes组件架构图: 准备基础环境 我们将使用kubeadm部署3个节点的 Kubernetes Cluster,整体 ...

  2. kubeadm使用外部etcd部署kubernetes v1.17.3 高可用集群

    文章转载自:https://mp.weixin.qq.com/s?__biz=MzI1MDgwNzQ1MQ==&mid=2247483891&idx=1&sn=17dcd7cd ...

  3. 附025.kubeadm部署Kubernetes更新证书

    一 查看证书 1.1 查看过期时间-方式一 1 [root@master01 ~]# tree /etc/kubernetes/pki/ 2 [root@master01 ~]# for tls in ...

  4. kubeadm部署高可用集群Kubernetes 1.14.1版本

    Kubernetes高可用集群部署 部署架构: Master 组件: kube-apiserver Kubernetes API,集群的统一入口,各组件协调者,以HTTP API提供接口服务,所有对象 ...

  5. 附012.Kubeadm部署高可用Kubernetes

    一 kubeadm介绍 1.1 概述 参考<附003.Kubeadm部署Kubernetes>. 1.2 kubeadm功能 参考<附003.Kubeadm部署Kubernetes& ...

  6. 使用kubeadm部署K8S v1.17.0集群

    kubeadm部署K8S集群 安装前的准备 集群机器 172.22.34.34 K8S00 172.22.34.35 K8S01 172.22.34.36 K8S02 注意: 本文档中的 etcd . ...

  7. [转帖]CentOS 7 使用kubeadm 部署 Kubernetes

    CentOS 7 使用kubeadm 部署 Kubernetes   关闭swap 执行swapoff临时关闭swap. 重启后会失效,若要永久关闭,可以编辑/etc/fstab文件,将其中swap分 ...

  8. 002.使用kubeadm安装kubernetes 1.17.0

    一 环境准备 1.1 环境说明 master      192.168.132.131      docker-server1 node1       192.168.132.132      doc ...

  9. 02 . Kubeadm部署Kubernetes及简单应用

    kubeadm部署Kubernetes kubeadm简介 # kubeadm是一位高中生的作品,他叫Lucas Kaldstrom,芬兰人,17岁用业余时间完成的一个社区项目: # kubeadm的 ...

随机推荐

  1. 【visio】 图片

    1.背景页设置 新建背景页:新建页面>设计>页面设置>页属性      使用背景页:在页属性页的"背景" 选项里,选择需要的背景. 2.插入图片 支持插入本地图片 ...

  2. java篇 之 静态

    Final:不可改变 Static:静态修饰符,在编译阶段就能确定了,可以修饰成员变量,相应的称之为静态变量 是一个共享的变量(被这个类和这个类所产生的对象所共享的,他是唯一的,出生时间 为类第一次产 ...

  3. vue 每20秒刷新1次接口的实现方法

    实现代码: setInterval(() => { setTimeout(fun, ) }, ) 备注: setInterval 放在内层 长时间会影响性能,造成页面卡顿甚至崩溃, 内层配合se ...

  4. oracle常见的函数

    1.字符函数 -- initcap函数只针对英文 select * from tb_user where user_name = initcap('张三'); -- ltrim 左剪切 select ...

  5. springboot笔记-1.自动化配置的关键

    最近发现看过的东西容易忘,但是写一遍之后印象倒是会深刻的多. 总所周知springboot极大的简化了java开发繁琐性,而其最大的优势应该就是自动化配置了.比如要使用redis,我们直接引入相关的包 ...

  6. 【C语言】判断某一正整数是否为完数

    什么是完数? 如果一个数等于它的因子之和,则称该数为“完数”(或“完全数”). 例如,6的因子为1.2.3,而 6=1+2+3,因此6是“完数”. 程序框图:m  问题分析 根据完数的定义,解决本题的 ...

  7. Mac 配置 React Native 环境

    OSX系统,这里假定你是iOS开发人员 Homebrew 是需要的,只有安装了Homebrew才能继续安装watchman和flow 安装 Node.js 4.0 或者更新的版本. 使用 Homebr ...

  8. Vue-项目搭建时的常用配置

    1.Vue静态资源存放的选择 assets: 编译过程中会被webpack处理理解为模块依赖,只支持相对路径的形式,assets放可能会变动的文件.static: 存放第三方文件的地方,不会被webp ...

  9. 中山纪中Day1--普及

    早上一起,扑面是瓢泼的大雨.跨过千山万水,来到纪中门前,毅然以一种大无畏的英雄气概跨进了考场. 面对四道神题.然后,我成功过五关斩六将,A掉了2道题!!! 收获:优先队列(大.小根堆) T1:APPL ...

  10. PyQt5程序基本结构分析

    面向过程版 # 0. 导入需要的包和模块 from PyQt5.Qt import * # 包含了我们常用的QT中的一些类 import sys # 一个内置的模块,系统相关操作 # 代码执行的时候, ...