Skip to content

Instantly share code, notes, and snippets.

@rezamt
Created March 24, 2019 07:44
Show Gist options
  • Save rezamt/c9811f8b0c148371841ba6bd2fc74903 to your computer and use it in GitHub Desktop.
Save rezamt/c9811f8b0c148371841ba6bd2fc74903 to your computer and use it in GitHub Desktop.
Creating sample k8s user
#!/bin/bash
kubectl apply -f dashboard-adminuser.yaml
# Create Service Account
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
# Create ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kube-system
#!/bin/bash
echo "Authenticating against running cluster"
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin | awk '{print $1}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment