Table of Contents generated with DocToc
A Golang based knitnet operator that will make/oversee Submariner components on top of the Kubernetes.
The purpose of creating this operator was to provide an easy and production-grade setup of Submariner components on Kubernetes. It doesn't care if you have a plain on-prem Kubernetes or cloud-based.
Here the features which are supported by this operator:-
- Deploy submariner broker
- Join cluster to broker
- Check k8s server version
- Support cloud prepare (aws, gcp)
- Support lighthouse, globalnet enable/disable
The configuration of Knitnet setup should be described in Knitnet CRD. You will find all the examples manifests in example folder.
Knitnet operator requires a Kubernetes cluster of version >=1.5.0
. If you have just started with Operators, its highly recommended to use latest version of Kubernetes. And the prepare 2 cluster, example cluster-a
and cluster-b
The setup can be done by using kustomize
.
-
Clone source code
git clone https://github.com/tkestack/knitnet-operator.git
-
Deploy broker
-
Install knitnet operator
kubectl config use-context cluster-a cd knitnet-operator make deploy
-
Deploy broker on
cluster-a
Add
publicAPIServerURL
in./config/samples/deploy_broker.yaml
, find the public apiserver URL with command:kubectl config view | grep server | cut -f 2- -d ":" | tr -d " "
kubectl -n knitnet-operator-system apply -f ./config/samples/deploy_broker.yaml
-
Export
submariner-broker-info
configmap to a yaml filekubectl -n knitnet-operator-system get cm submariner-broker-info -oyaml > submariner-k8s-broker.yaml
-
-
Join cluster to broker
-
Install knitnet operator
kubectl config use-context cluster-b make deploy
-
Create
submariner-broker-info
configmapkubectl apply -f submariner-k8s-broker.yaml
-
Join
cluster-b
tocluster-a
kubectl -n knitnet-operator-system apply -f ./config/samples/join_broker.yaml
-
-
Deploy ClusterIP service on
cluster-b
kubectl config use-context cluster-b kubectl -n default create deployment nginx --image=nginx kubectl -n default expose deployment nginx --port=80
-
Export service
Create following resource on
cluster-b
:kubectl apply -f - <<EOF apiVersion: multicluster.x-k8s.io/v1alpha1 kind: ServiceExport metadata: name: nginx namespace: default EOF
-
Run
nettest
fromcluster-a
to access the nginx service:kubectl config use-context cluster-a kubectl -n default run --generator=run-pod/v1 tmp-shell --rm -i --tty --image quay.io/submariner/nettest -- /bin/bash curl nginx.default.svc.clusterset.local:80