kubernetes部署kubeview集群结构预览工具

  运维


主页

rbac

apiVersion: v1
kind: ServiceAccount
metadata:
  name: kubeview
  namespace: kube-system

---

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: kubeview
rules:
  - apiGroups: ["extensions"]
    resources:
      - ingresses
    verbs: ["get", "list"]
  - apiGroups: ["apps"]
    resources:
      - deployments
      - replicasets
      - daemonsets
      - statefulsets
    verbs: ["get", "list"]
  - apiGroups: [""]
    resources:
      - pods
      - ingresses
      - events
      - endpoints
      - namespaces
      - nodes
      - persistentvolumes
      - persistentvolumeclaims
      - resourcequotas
      - services
    verbs: ["get", "list"]
  - nonResourceURLs: ["*"]
    verbs: ["get", "list"]

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kubeview
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kubeview
subjects:
  - kind: ServiceAccount
    name: kubeview
    namespace: kube-system

Deployment

kind: Deployment
apiVersion: apps/v1
metadata:
  name: kubeview
  labels:
    app: kubeview
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kubeview
  template:
    metadata:
      labels:
        app: kubeview
    spec:
      serviceAccountName: kubeview
      containers:
      - name: kubeview-containers

        image: bencuk/kubeview:latest
        imagePullPolicy: IfNotPresent

        ports:
        - containerPort: 8000

        resources:
          limits:
            memory: "128M"
            cpu: "0.1"

svc

kind: Service
apiVersion: v1
metadata:
  labels:
    app: kubeview
  name: kubeview
spec:
  type: NodePort
  ports:
  - name: kubeview
    port: 8000
    targetPort: 8000
    nodePort: 30084
    protocol: TCP
  selector:
    app: kubeview

LEAVE A COMMENT

发表评论前,请选对水果【Apple=苹果、Banana=香蕉、Pineapple=菠萝、Grapes=葡萄】 Banana...