使用OpenSSL生成Kubernetes證書的介紹
kubernetes支持Base認(rèn)證/Token認(rèn)證/CA認(rèn)證三種,這篇文章用于記錄一下CA認(rèn)證所需要的最簡(jiǎn)單程度的命令。
kubernetes構(gòu)成
測(cè)試版本為1.10,但不限于此版本,為openssl證書較為通用的方式。
所需證書
所需要的證書相關(guān)文件的說(shuō)明如下:
CA證書
CA證書私鑰
命令:openssl genrsa -out ca.key 2048
[root@host121 k8scert]# openssl genrsa -out ca.key 2048 Generating RSA private key, 2048 bit long modulus ........................................................+++ ..................+++ e is 65537 (0x10001) [root@host121 k8scert]#
CA證書
命令:openssl genrsa -out ca.key 2048
[root@host121 k8scert]# openssl req -x509 -new -nodes -key ca.key -subj "/CN=host121" -days 5000 -out ca.crt [root@host121 k8scert]# ls archive ca.crt ca.key [root@host121 k8scert]#
XXX用證書
apiserver/ControllerManager/kublet等所需證書可用如下方式創(chuàng)建
證書私鑰
命令:openssl genrsa -out server.key 2048
[root@host121 k8scert]# openssl genrsa -out server.key 2048 Generating RSA private key, 2048 bit long modulus ..............................+++ ........................................................................+++ e is 65537 (0x10001) [root@host121 k8scert]#
證書簽名請(qǐng)求文件
命令:openssl req -new -key server.key -subj “/CN=host121” -out server.csr
[root@host121 k8scert]# openssl req -new -key server.key -subj "/CN=host121" -out server.csr [root@host121 k8scert]#
subj中設(shè)定的subject的信息為用戶自己的數(shù)據(jù),一般將CN設(shè)定為域名/機(jī)器名/或者IP名稱,比如kubelet為所在node的IP即可
證書
命令:openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 5000
[root@host121 k8scert]# openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 5000 Signature ok subject=/CN=host121 Getting CA Private Key [root@host121 k8scert]#
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接
相關(guān)文章
詳解通過(guò)Docker搭建Mysql容器+Tomcat容器連接環(huán)境
本篇文章主要介紹了通過(guò)Docker搭建Mysql容器+Tomcat容器連接環(huán)境,具有一定的參考價(jià)值,有興趣的可以了解一下。2017-01-01docker安裝tomcat并部署Springboot項(xiàng)目war包的方法
這篇文章主要介紹了docker安裝tomcat并部署Springboot項(xiàng)目war包的方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-11-11docker push遇到unknown blob問(wèn)題解決
這篇文章主要為大家介紹了docker push遇到unknown blob問(wèn)題解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-11-11將Docker容器打包并在其他服務(wù)器上運(yùn)行的全過(guò)程
Docker容器使得應(yīng)用程序的部署和管理變得更加簡(jiǎn)單和高效,有時(shí),我們可能需要將一個(gè)運(yùn)行中的Docker容器打包,并在其他服務(wù)器上運(yùn)行,本文將詳細(xì)介紹如何實(shí)現(xiàn)這一過(guò)程,需要的朋友可以參考下2024-05-05滾動(dòng) docker 中的 nginx 日志思路詳解
Nginx 自己沒(méi)有處理日志的滾動(dòng)問(wèn)題,本文筆者介紹如何滾動(dòng)運(yùn)行在 docker 中的 nginx 日志文件,感興趣的朋友一起看看吧2018-08-08詳解Docker 配置國(guó)內(nèi)免費(fèi)registry mirror
本篇文章主要介紹了 Docker 配置國(guó)內(nèi)免費(fèi)registry mirror,具有一定的參考價(jià)值,有興趣的小伙伴們可以參考一下2017-07-07