The K8s Best Security Practices is a medium difficulty room from TryHackMe available to all users for free. It can be reached at: https://tryhackme.com/r/room/k8sbestsecuritypractices
1.1 What are the credentials associated with a ServiceAccount stored as?
Answer: secrets
1.2 Kubernetes ServiceAccounts are Lightweight, Namespaced and which other attribute?
Answer: Portable
2.1 You have defined a “Role”. What should you now define to associate that role with an identity?
Answer: RoleBinding
2.2 You now want to define permissions at a cluster level; what do you define?
Answer: ClusterRole
2.3 In which field under “rules” would you define the actions that can be performed on a resource? (in the role YAML/spec)
Answer: verbs
2.4 In which field under “rules” would you define to what those actions should be applied? (in the role YAML/spec)
Answer: resources
3.1 Which cluster access method would be vulnerable to a MITM attack?
Answer: Auth Token
3.2 Which API request stage would RBAC be involved in?
Answer: Authorisation
3.3 In which API request stage would we find the words “Mutating” and “Validating”?
Answer: Admission Controllers
3.4 In which API request stage would a ServiceAccount token be used to verify a ServiceAccount?
Answer: Authentication
4.1 Which best security practice should be introduced to the CI/CD pipeline?
Answer: Image Scanning
4.2 What should be set as “false” in configuration to ensure a container cannot have its privileges escalated?
Answer: allowPrivilegeEscalation
4.3 To ensure the security of etcd , it should be isolated, behind a firewall and?
Answer: encrypted
4.4 How many cluster upgrades would you have to do to go from version 1.21 to 1.25
Answer: 4
5.1 What’s the encoded role?
Answer: TmFtZTogICAgICAgICBwb2QtY2hlY2tlci1yb2xlCkxhYmVsczogICAgICAgPG5vbmU+CkFubm90YXRpb25zOiAgPG5vbmU+ClBvbGljeVJ1bGU6CiAgUmVzb3VyY2VzICBOb24tUmVzb3VyY2UgVVJMcyAgUmVzb3VyY2UgTmFtZXMgIFZlcmJzCiAgLS0tLS0tLS0tICAtLS0tLS0tLS0tLS0tLS0tLSAgLS0tLS0tLS0tLS0tLS0gIC0tLS0tCiAgcG9kcyAgICAgICBbXSAgICAgICAgICAgICAgICAgW10gICAgICAgICAgICAgIFtnZXQgbGlzdF0=