config

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 10 Imported by: 0

README

kube集群内部署

集群内部署需要权限 kubectl执行

serviceaccount 请调整为实际环境account。在未指定spec.serviceAccount情况下默认为namespace::default

kubectl create clusterrolebinding go-kratos:kube --clusterrole=view --serviceaccount=mesh:default

或者 kubect apply -f bind-role.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: go-kratos:kube
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: view
subjects:
- kind: ServiceAccount
  name: default
  namespace: mesh

集群外运行

指定 .kube 文件访问

    config.NewSource(SourceOption{
		Namespace:     "mesh",
		LabelSelector: "",
		KubeConfig:    filepath.Join(homedir.HomeDir(), ".kube", "config"),
	})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSource

func NewSource(opts ...Option) config.Source

NewSource new a kube config source.

Types

type Option

type Option func(*options)

Option is kube option.

func FieldSelector

func FieldSelector(field string) Option

FieldSelector with kube field selector.

func KubeConfig

func KubeConfig(config string) Option

KubeConfig with kube config.

func LabelSelector

func LabelSelector(label string) Option

LabelSelector with kube label selector.

func Master

func Master(master string) Option

Master with kube master.

func Namespace

func Namespace(ns string) Option

Namespace with kube namespace.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL