Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .infrastructure/security/rbac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: secrets-reader
namespace: todoapp

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: todoapp # This is the namespace where the role will be created
name: secrets-lister-role # This is the name of the role
rules:
- apiGroups: [""] # "" indicates the core API group, which includes all core APIs
resources: ["pods", "secrets"] # Indicates the resources that the role can access, in this case, pods

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resources field includes pods, which might not be necessary if the intention is only to list and get secrets. Ensure that pods is intentionally included here.

verbs: ["list", "get", "watch"] # Indicates the actions that the role can perform on the resources

---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: secrets-lister-role-binding
namespace: todoapp
subjects:
- kind: ServiceAccount # this can also be "Group" or "ServiceAccount".
name: secrets-reader # name of the user, group or service account.
apiGroup: rbac.authorization.k8s.io # this is always "rbac.authorization.k8s.io".
Comment on lines +26 to +27

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The apiGroup for the subjects section should be empty ("") for ServiceAccount subjects, as they belong to the core API group. The current value rbac.authorization.k8s.io is incorrect.

roleRef:
kind: Role # this must be Role or ClusterRole.
name: secrets-lister-role # name of the Role or ClusterRole to bind.
apiGroup: rbac.authorization.k8s.io # this is always "rbac.authorization.k8s.io"


3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extensions.closeExtensionDetailsOnViewChange": true
}
Empty file added INSTRUCTION.md
Empty file.
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ kubectl apply -f .infrastructure/app/clusterIp.yml
kubectl apply -f .infrastructure/app/nodeport.yml
kubectl apply -f .infrastructure/app/hpa.yml
kubectl apply -f .infrastructure/app/deployment.yml

kubectl apply -f .infrastructure/security/rbac.yml
# Install Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
# kubectl apply -f .infrastructure/ingress/ingress.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line for applying the ingress configuration is commented out. If the ingress is needed for your application, ensure to uncomment this line. Otherwise, if it's intentional, you can leave it as is.