Giter VIP home page Giter VIP logo

namespace-provisioner's Issues

Deployment in k8s 1.16 fails

The provided task deploy-local fails when trying to deploy the namespace provisioner into minikube with running k8s version 1.16, because the used apiVersion extensions/v1beta1 for Deployment is not served by default in k8s 1.16.

RFC: Use a ServiceAccount rather than user-supplied .kube/config

Hi,

I was following the README file to set up the namespace provisioner in minikube. The step that required me to supply my own kube config didn't work quite as expected, since minkube hardcodes path to certificates and private key to host paths, rather than supplying them as base64-encoded '-data'. Additionally, I wasn't sure about adding user account data to a service made any sense. So, I found out there's something called ServiceAccount, which was made exactly for these purposes.

I modified the installation as follows:

  • Create ServiceAccount
apiVersion: v1
kind: ServiceAccount
metadata:
  name: namespace-provisioner
  • Create ClusterRole (way too permissive one)
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: namespace-provisioner
rules:
  - apiGroups: ["", "batch", "extensions", "apps", "rbac.authorization.k8s.io", "networking.k8s.io"]
    resources: ["*"]
    verbs: ["*"]
  • Create ClusterRoleBinding, ServiceAccount -> ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: namespace-provisioner
  namespace: default
subjects:
- kind: ServiceAccount
  name: namespace-provisioner
  namespace: default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: namespace-provisioner
  • Modified the deployment as follows (added serviceAccountName)
apiVersion: apps/v1
kind: Deployment
metadata:
  name: namespace-provisioner-deployment
  labels:
    app: namespace-provisioner
spec:
  replicas: 1
  selector:
    matchLabels:
      app: namespace-provisioner
  template:
    metadata:
      labels:
        app: namespace-provisioner
    spec:
      serviceAccountName: namespace-provisioner
      containers:
      - name: namespace-provisioner
...
  • Used the following .kube/config, and put it into kube-config ConfigMap
apiVersion: v1
clusters:
- cluster:
    certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    server: https://kubernetes.default.svc
  name: default
contexts:
- context:
    cluster: default
    user: default
  name: default
current-context: default
kind: Config
preferences: {}
users:
- name: default
  user:
    tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token

There are two things here that could be improved. First one is obviously cluster role, which is way too permissive, and should be restricted to what the namespace-provisioner can/should manage.

Second one is obviously providing hardcoded .kube/config from outside, when it can be placed inside docker image, or not used at all, and use the kubernetes API with service accounts, as intended.

Docker image size looks quite large

When looking at the Docker image that is created using task docker:build it shows a size of approx. 80 MB although the Alpine base image's size is approx. 5 MB and the namespace-provisioner executable's size is approx. 37 MB.
When taking a detailed look at the layers of the image it can be noticed that there are 2 layers with exactly the same size and approx. the size of the namespace-provisioner's executable. Maybe there's something wrong with the Docker image creation.

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.