Question 1 (15')
Take a backup of the etcd cluster and save it to /opt/etcd-backup.db
.
Question 2 (15')
Create a Pod called redis-storage
with image: redis:alpine
with a Volume of type emptyDir
that lasts for the life of the Pod.
Specs on the below.
Question 3 (8')
Create a new pod called super-user-pod
with image busybox:1.28
. Allow the pod to be able to set system_time
.
The container should sleep for 4800 seconds.
Question 4 (12')
A pod definition file is created at /root/CKA/use-pv.yaml
. Make use of this manifest file and mount the persistent volume called pv-1
. Ensure the pod is running and the PV is bound.
mountPath: /data
persistentVolumeClaim Name: my-pvc
Question 5 (20')
Create a new deployment called nginx-deploy
, with image nginx:1.16
and 1
replica. Next upgrade the deployment to version 1.17
using rolling update.
Question 6 (10')
Create a new user called john
. Grant him access to the cluster. John should have permission to create, list, get, update and delete pods
in the development
namespace . The private key exists in the location: /root/CKA/john.key
and csr at /root/CKA/john.csr
.
Important Note
: As of kubernetes 1.19, the CertificateSigningRequest object expects a signerName
.
Please refer the documentation to see an example. The documentation tab is available at the top right of terminal.
Question 7 (20')
Create a pod called secret-1401
in the admin1401
namespace using the busybox
image. The container within the pod should be called secret-admin
and should sleep for 4800
seconds.
The container should mount a read-only
secret volume called secret-volume
at the path /etc/secret-volume
. The secret being mounted has already been created for you and is called dotfile-secret
.
Details
- CSR: john-developer Status:Approved
- Role Name: developer, namespace: development, Resource: Pods
- Access: User 'john' has appropriate permissions
Solution
manifest file to create a CSR as follows:
---
apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
name: john-developer
spec:
signerName: kubernetes.io/kube-apiserver-client
request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZEQ0NBVHdDQVFBd0R6RU5NQXNHQTFVRUF3d0VhbTlvYmpDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRApnZ0VQQURDQ0FRb0NnZ0VCQUt2Um1tQ0h2ZjBrTHNldlF3aWVKSzcrVVdRck04ZGtkdzkyYUJTdG1uUVNhMGFPCjV3c3cwbVZyNkNjcEJFRmVreHk5NUVydkgyTHhqQTNiSHVsTVVub2ZkUU9rbjYra1NNY2o3TzdWYlBld2k2OEIKa3JoM2prRFNuZGFvV1NPWXBKOFg1WUZ5c2ZvNUpxby82YU92czFGcEc3bm5SMG1JYWpySTlNVVFEdTVncGw4bgpjakY0TG4vQ3NEb3o3QXNadEgwcVpwc0dXYVpURTBKOWNrQmswZWhiV2tMeDJUK3pEYzlmaDVIMjZsSE4zbHM4CktiSlRuSnY3WDFsNndCeTN5WUFUSXRNclpUR28wZ2c1QS9uREZ4SXdHcXNlMTdLZDRaa1k3RDJIZ3R4UytkMEMKMTNBeHNVdzQyWVZ6ZzhkYXJzVGRMZzcxQ2NaanRxdS9YSmlyQmxVQ0F3RUFBYUFBTUEwR0NTcUdTSWIzRFFFQgpDd1VBQTRJQkFRQ1VKTnNMelBKczB2czlGTTVpUzJ0akMyaVYvdXptcmwxTGNUTStsbXpSODNsS09uL0NoMTZlClNLNHplRlFtbGF0c0hCOGZBU2ZhQnRaOUJ2UnVlMUZnbHk1b2VuTk5LaW9FMnc3TUx1a0oyODBWRWFxUjN2SSsKNzRiNnduNkhYclJsYVhaM25VMTFQVTlsT3RBSGxQeDNYVWpCVk5QaGhlUlBmR3p3TTRselZuQW5mNm96bEtxSgpvT3RORStlZ2FYWDdvc3BvZmdWZWVqc25Yd0RjZ05pSFFTbDgzSkljUCtjOVBHMDJtNyt0NmpJU3VoRllTVjZtCmlqblNucHBKZWhFUGxPMkFNcmJzU0VpaFB1N294Wm9iZDFtdWF4bWtVa0NoSzZLeGV0RjVEdWhRMi80NEMvSDIKOWk1bnpMMlRST3RndGRJZjAveUF5N05COHlOY3FPR0QKLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0tCg==
usages:
- digital signature
- key encipherment
- client auth
To approve this certificate, run: kubectl certificate approve john-developer
Next, create a role developer
and rolebinding developer-role-binding
, run the command:
$ kubectl create role developer --resource=pods --verb=create,list,get,update,delete --namespace=development
$ kubectl create rolebinding developer-role-binding --role=developer --user=john --namespace=development
To verify the permission from kubectl utility tool:
$ kubectl auth can-i update pods --as=john --namespace=development
标签:Exam,Kubernetes,--,Question,KodeKloud,pod,john,called,developer
From: https://www.cnblogs.com/Bota5ky/p/16797323.html