Coder Social home page Coder Social logo

rbac-kubeconfig's Introduction

RBAC KUBECONFIG WITH ROLE AND CLUSTER ROLE

Brief Explanation

You can use this script for generate kubeconfig using role for specific namespace or cluster role for cluster

Before You Begin

  1. Use chmod to allow execute script
chmod u+x *.sh

Generate Kubeconfig with Role

  1. define you USER_NAME and NAMESPACE
export USER_NAME=developer
export NAMESPACE=mynamespace
  1. Create manifest
./create_manifest.sh
  1. Apply to kubernetes
kubectl apply -f rbac_manifests.yaml
  1. Create kubeconfig
./create_kubeconfig.sh
  1. You can use new config to test
kubectl --kubeconfig config get pods

Generate Kubeconfig with Cluster Role

  1. define you USER_NAME
export USER_NAME=developer
  1. Create manifest
./create_manifest_cluster_role.sh
  1. Apply to kubernetes
kubectl apply -f rbac_manifests.yaml
  1. Create kubeconfig
./create_kubeconfig_cluster_role.sh
  1. You can use new config to test
kubectl --kubeconfig config get pods

###Update Rules

  1. Take a look in create_manifest script. Here you can update rule to your RBAC
rules:
  - apiGroups: [""]
    resources: ["pods", "services", "namespaces", "nodes"]
    verbs: ["get", "list", "watch"]
  - apiGroups: [""]
    resources: ["pods/portforward"]
    verbs: ["create", "get", "update", "list", "delete", "watch", "patch"]
  - apiGroups: ["apps"]
    resources: ["deployments", "statefulsets", "daemonsets", "replicasets"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["rbac.authorization.k8s.io"]
    resources: ["clusterroles", "clusterrolebindings"]
    verbs: ["get", "list", "watch"]

rbac-kubeconfig's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.