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 #23

Open
wants to merge 2 commits 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
2 changes: 1 addition & 1 deletion .infrastructure/app/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
labels:
app: todoapp
spec:
serviceAccountName: secrets-reader
serviceAccountName: secrets-lister
containers:
- name: todoapp
image: ikulyk404/todoapp:4.0.1
Expand Down
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-lister
namespace: todoapp

---

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: todoapp
name: secret-lister
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list", "get"]

---

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: secret-lister-binding
namespace: todoapp
subjects:
- kind: ServiceAccount
name: secrets-lister
roleRef:
kind: Role
name: secret-lister
apiGroup: rbac.authorization.k8s.io

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,18 @@ Now you can browse the [API](http://localhost:8000/api/) or start on the [landin
1. Execute a curl command to list secrets from the `Deployment` pod to list secrets
1. Make a screenshot of the output and attach it to the PR
1. `README.md` should have instructuions on how to validate the changes

Connect to cluster's pod:

```
kubectl exec todoapp-{random symbols} -it -n todoapp -- sh
```

Check secrets:

```
curl -k -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
https://kubernetes.default.svc/api/v1/namespaces/todoapp/secrets
```

1. Create PR with your changes and attach it for validation on a platform.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.