当前位置:网站首页>Kubernetes cluster configuration serviceaccount
Kubernetes cluster configuration serviceaccount
2022-07-28 08:58:00 【Brother Xing plays with the clouds】
Kubernetes API Other services .Service Account It's not for kubernetes colony Users of , But to pod The process inside uses , It's for pod Provide necessary identity authentication .
Kubernetes Provides Secret To handle sensitive information , at present Secret There are types of 3 Kind of : Opaque(default): Any string kubernetes.io/service-account-token: Act on ServiceAccount kubernetes.io/dockercfg: Act on Docker registry, User download docker Image authentication uses .
This article will introduce you to kubernetes colony Middle configuration serviceaccount and secret, It can make kubernetes Use private warehouses , And support nginx basic authentication . Because we use rpm Package installation kubernetes colony , There is no default ca.crt、kubecfg.crt kubecfg.key 、server.cert 、server.key These documents , You need to download the source code to generate .
One 、 Use tools to generate key file
# mkdir git # cd git/ # git clone https://github.com/kubernetes/kubernetes
Download scientifically online easy-rsa.tar.gz, The download address is make-ca-cert.sh You can find... In the script , Put the document in ~/kube Under the table of contents
# ls ~/kube easy-rsa.tar.gz # cd /root/git/kubernetes/ # sh cluster/CentOS/make-ca-cert.sh 192.168.115.5 # ls /srv/kubernetes/ ca.crt kubecfg.crt kubecfg.key server.cert server.key # chown -R kube:kube /srv/kubernetes/*
Send these files to vm2 The same directory of the host
# chown -R kube:kube /srv/kubernetes/* # scp -rp /srv/ [email protected]:/
Two 、 Modify the configuration file
# grep -v '^#' /etc/kubernetes/apiserver |grep -v '^$' KUBE_API_ADDRESS="--insecure-bind-address=192.168.115.5" KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.115.5:2379" KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16" KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,ServiceAccount,SecurityContextDeny,ResourceQuota" KUBE_API_ARGS="--storage-backend=etcd2 --secure-port=6443 --client-ca-file=/srv/kubernetes/ca.crt --tls-cert-file=/srv/kubernetes/server.cert --tls-private-key-file=/srv/kubernetes/server.key"# grep -v '^#' /etc/kubernetes/controller-manager |grep -v '^$' KUBE_CONTROLLER_MANAGER_ARGS="--root-ca-file=/srv/kubernetes/ca.crt --service-account-private-key-file=/srv/kubernetes/server.key"
3、 ... and 、 Restart related services
Master: # systemctl restart kube-apiserver # systemctl restart kube-controller-manager # systemctl restart kube-scheduler
Slave: # systemctl restart kubelet # systemctl restart kube-proxy
# kubectl get secret # kubectl describe secret default-token-6pddn
Four 、 By configuring secret, Give Way kubernetes You can pull images from private warehouses
# kubectl create secret docker-registry regsecret \ --docker-server=registry.fjhb.cn \ --docker-username=ylw \ --docker-password=123 \ [email protected]
stay yaml file sepc Section added imagePullSecrets, Specify to use the created secret
# kubectl create -f frontend-controller.yaml
By reference kubernetes Official documents of , It doesn't solve the real problem https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
nginx Log still reported 401 Authentication error
We know how to use docker pull There is a warehouse to get the image , You need to use it first docker login Log in to the private warehouse , and login Actions performed , In fact, it is written in the user's home directory .docker/config.json file . Make this file a soft link to /var/lib/kubelet/.docker/ This problem can be solved . When the soft connection is configured, there is no need to yaml The file refers to the previously created secret 了 .
# cat /root/.docker/config.json # ln -s /root/.docker/ /var/lib/kubelet/.docker/
# kubectl create -f frontend-controller.yaml
边栏推荐
- MySQL怎么查询可以同时判断多个字段值是否存在
- Smart software completed round C financing, making Bi truly "inclusive"
- Gb/t 41479-2022 information security technology network data processing security requirements map overview
- Go panic and recover
- Introduction to self drive tour of snow mountains in the West in January 2018
- Dry goods semantic web, Web3.0, Web3, metauniverse, these concepts are still confused? (top)
- Why can ThreadLocal achieve thread isolation?
- Vk1620 temperature controller / smart meter LED digital display driver chip 3/4-wire interface with built-in RC oscillator to provide technical support
- Chapter 2-14 sum integer segments
- PostgreSQL:无法更改视图或规则使用的列的类型
猜你喜欢

思迈特软件Smartbi完成C轮融资,推动国产BI加速进入智能化时代

C #, introductory tutorial -- debugging skills and logical error probe technology and source code when the program is running

linux初始化mysql时报错 FATAL ERROR: Could not find my-default.cnf
![[activity registration] User Group Xi'an - empowering enterprise growth with modern data architecture](/img/92/88be42faf0451cb19067672dab69c8.jpg)
[activity registration] User Group Xi'an - empowering enterprise growth with modern data architecture

Flink window & time principle

Chapter 2-14 sum integer segments

Hcip day 9_ BGP experiment

解决:IndexError: index 13 is out of bounds for dimension 0 with size 13
![Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]](/img/9c/b4ebe608cf639b8348adc1f1cc71c8.png)
Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]
![Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]](/img/97/6c3662ef36b02bc42eec95abaa6bc5.png)
Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]
随机推荐
I am a 27 year old technical manager, whose income is too high, and my heart is in a panic
置顶各大平台,22版面试核心知识解析笔记,强势上榜
微服务架构 Sentinel 的服务限流及熔断
Larkapi access credentials overview
创建线程的3种方式
Win the bid! Nantah general gbase 8s won the bid for the 2022 database framework project of NARI Group
Detailed explanation of switch link aggregation [Huawei ENSP]
C轮融资已完成!思迈特软件领跑国内BI生态赋能,产品、服务竿头一步
Round C financing has been completed! Smart software leads domestic Bi ecological empowerment, and products and services are a step forward
Analysis of model predictive control (MPC) (IX): numerical solution of quadratic programming (II)
第2章-14 求整数段和
Data fabric, next air outlet?
Learn to draw with nature communications -- complex violin drawing
看完这12个面试问题,新媒体运营岗位就是你的了
Service current limiting and fusing of micro service architecture Sentinel
Why is the text box of Google material design not used?
This flick SQL timestamp_ Can ltz be used in create DDL
CAT1 4g+ Ethernet development board 232 data is sent to the server through 4G module TCP
Sliding screen switching on uniapp supports video and image rotation, similar to Tiktok effect
象棋机器人夹伤7岁男孩手指,软件测试工程师的锅?我笑了。。。