Compare commits

...

2 Commits

Author SHA1 Message Date
e103078eab
Add mysql cluster operator and rbac in sample 2022-01-14 10:33:35 +07:00
Sambo Chea
e7e44fdee3
Update README.md 2022-01-14 10:07:11 +07:00
5 changed files with 134 additions and 1 deletions

View File

@ -199,7 +199,7 @@ kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
#### Kubernetes Dashboard
```shell
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.3.1/aio/deploy/recommended.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml
```
- Proxy for kubernetes dashboard
```shell

15
mysql/mysql-cluster.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Namespace
metadata:
name: mysql
---
apiVersion: mysql.oracle.com/v2alpha1
kind: InnoDBCluster
metadata:
name: mysql-cluster
namespace: mysql
spec:
secretName: mysql-secret
instances: 3
router:
instances: 1

1
rbac/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
developer-user.yaml

74
rbac/README.md Normal file
View File

@ -0,0 +1,74 @@
# Create RBAC for specific namespace
- Apply RBAC for specific namespace
```shell
k apply -f access.yaml
```
- Get Details of RBAC
```shell
k describe sa developer -n developer-dev
```
- Get Token from RBAC
```shell
k get secret developer-token-l4r67 -n developer-dev -o "jsonpath={.data.token}" | base64 -d
```
- Get Certificate from RBAC
```shell
k get secret developer-token-l4r67 -n developer-dev -o "jsonpath={.data['ca\.crt']}"
```
- Create kube config file
```yaml
apiVersion: v1
kind: Config
preferences: {}
cluster:
certificate-authority-data: PLACE CERTIFICATE HERE
server: https://YOUR_KUBERNETES_API_ENDPOINT
name: developer-cluster
users:
- name: developer
user:
as-user-extra: {}
client-key-data: PLACE CERTIFICATE HERE
token: PLACE USER TOKEN HERE
contexts:
- context:
cluster: kubernetes
namespace: developer-dev
user: developer
name: developer-dev
current-context: developer-dev
clusters:
- cluster:
certificate-authority-data: PLACE CERTIFICATE HERE
server: https://YOUR_KUBERNETES_API_ENDPOINT
name: developer-cluster
users:
- name: developer
user:
as-user-extra: {}
client-key-data: PLACE CERTIFICATE HERE
token: PLACE USER TOKEN HERE
contexts:
- context:
cluster: kubernetes
namespace: developer-dev
user: developer
name: developer-dev
current-context: developer-dev
```

43
rbac/access.yaml Normal file
View File

@ -0,0 +1,43 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app: developer-dev
name: developer-dev
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: developer
namespace: developer-dev
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: developer-full-access
namespace: developer-dev
rules:
- apiGroups: ["", "extensions", "apps"]
resources: ["*"]
verbs: ["*"]
- apiGroups: ["batch"]
resources:
- jobs
- cronjobs
verbs: ["*"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: developer-view
namespace: developer-dev
subjects:
- kind: ServiceAccount
name: developer
namespace: developer-dev
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: developer-full-access