Question : Deploy the given architecture diagram for implementing a Jekyll SSG
.
1. jekyll-site pv is already created. Inspect it before you create the pvc.
developer-role', should have all(*)
permissions for services in development namespace
developer-role', should have all
permissions(*) for persistentvolumeclaims in development namespace
developer-role', should have all(*)
permissions for pods in development namespace
Build user information for martin in the
default kubeconfig file: User = martin , client-key = /root/martin.key and
client-certificate = /root/martin.crt
Create a new context called 'developer' in
the default kubeconfig file with 'user = martin' and 'cluster = kubernetes'
root@controlplane
~ ➜ kubectl
get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS
CLAIM STORAGECLASS REASON
AGE jekyll-site 1Gi
RWX Delete Available local-storage 3m36s root@controlplane
~ ➜ |
2. Created YAML manifest files with all the parameters, Kindly clone repo or you can copy from GitLab
git clone https://gitlab.com/nb-tech-support/devops.git
( Refer Below Video for more clarity )
3. Create jekyll-site pvc & validate the status
root@controlplane ~ ➜ kubectl apply -f devops/kubernetes-challenges/challenge-1/jekyll-pvc.yaml root@controlplane ~ ➜ kubectl get pvc -A NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS
MODES STORAGECLASS AGE development jekyll-site Bound jekyll-site 1Gi RWX local-storage 3s root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
get pv -n development NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS
CLAIM STORAGECLASS REASON
AGE jekyll-site 1Gi
RWX Delete Bound development/jekyll-site local-storage 3m57s |
4. Create jekyll pod & validate the status
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-1/jekyll-pod.yaml pod/jekyll
created root@controlplane
~ ➜ kubectl
get pod -n development NAME READY
STATUS RESTARTS AGE jekyll 1/1
Running 0 58s root@controlplane
~ ➜ |
5. Create jekyll service & validate the status
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-1/jekyll-node-service.yaml service/jekyll
created root@controlplane ~ ➜ root@controlplane
~ ➜ kubectl
get svc -n development NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
AGE jekyll NodePort
10.98.111.195
<none>
8080:30097/TCP 14s root@controlplane
~ ➜ |
6. Create developer role & validate the status
root@controlplane
~ ➜ kubectl
create role developer-role --resource=pods,svc,pvc --verb="*" -n
development role.rbac.authorization.k8s.io/developer-role
created root@controlplane
~ ➜ kubectl
describe role -n development Name: developer-role Labels: <none> Annotations: <none> PolicyRule: Resources Non-Resource URLs Resource Names Verbs --------- ----------------- -------------- ----- persistentvolumeclaims [] [] [*] pods [] [] [*] services [] [] [*] |
7. Create developer rolebinding for user martin & validate the status
root@controlplane
~ ➜ kubectl
create rolebinding developer-rolebinding --role=developer-role --user=martin
-n development rolebinding.rbac.authorization.k8s.io/developer-rolebinding
created root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
describe rolebindings -n development Name: developer-rolebinding Labels: <none> Annotations: <none> Role: Kind:
Role Name:
developer-role Subjects: Kind
Name Namespace ----
---- --------- User
martin |
8. Build user information for martin in the default kubeconfig file: User = martin , client-key = /root/martin.key and client-certificate = /root/martin.crt
root@controlplane
~ ➜ ls martin.crt martin.csr
martin.key root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
config set-credentials martin --client-certificate ./martin.crt --client-key
./martin.key User
"martin" set. root@controlplane
~ ➜ kubectl
config get-users NAME kubernetes-admin martin root@controlplane
~ ➜ |
9. Create a new context called 'developer' in the default kubeconfig file with 'user = martin' and 'cluster = kubernetes'
root@controlplane
~ ➜ kubectl
config set-context developer --cluster kubernetes --user martin Context
"developer" created. CURRENT NAME CLUSTER AUTHINFO NAMESPACE developer kubernetes martin * kubernetes-admin@kubernetes kubernetes kubernetes-admin |
10. Validate the complete deployment of Jekyll SSG
root@controlplane
~ ➜ kubectl
get all -n development NAME READY STATUS
RESTARTS AGE pod/jekyll 1/1
Running 0 10m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/jekyll NodePort
10.98.111.195
<none>
8080:30097/TCP 6m55s root@controlplane
~ ➜ |
11. Click on Check & Confirm to complete the task successfully
Happy Learning!!!!
0 Comments