This repo will hold design documents and implementation of the Work API.
Learn how to engage with the Kubernetes community on the community page.
You can reach the maintainers of this project at:
This guide will cover:
- Create a
kind
cluster that acts as thehub
work delivery control plane. - Create a
kind
cluster that acts as thespoke
cluster for the work to be delivery to. - Install the
work
CRD to thehub
cluster. - Install the
appliedwork
CRD to thespoke
cluster. - Install the
work
agent components to thespoke
cluster. - Deploy a
work
example on thehub
cluster. - Verify all the contents inside the
work
has been delivered in thespoke
cluster.
Open a new terminal window and run the following commands:
cd /tmp
git clone [email protected]:kubernetes-sigs/work-api.git
kind delete cluster --name hub
kind create cluster --name hub
kind get kubeconfig --name hub > /tmp/hub-io-kubeconfig
export KUBECONFIG=/tmp/hub-io-kubeconfig
cd /tmp/work-api
kubectl apply -f config/crd
cp /tmp/hub-io-kubeconfig hub-kubeconfig
kubectl config set clusters.kind-hub.server https://hub-control-plane:6443 --kubeconfig hub-kubeconfig
Open another new terminal window and run the following commands:
kind delete cluster --name cluster1
kind create cluster --name cluster1
kind get kubeconfig --name cluster1 > /tmp/cluster1-io-kubeconfig
export KUBECONFIG=/tmp/cluster1-io-kubeconfig
cd /tmp/work-api
make docker-build
kind load docker-image --name=cluster1 work-api-controller:latest
kubectl apply -f deploy/component_namespace.yaml
kubectl delete secret hub-kubeconfig-secret -n fleet-system --ignore-not-found
kubectl create secret generic hub-kubeconfig-secret --from-file=kubeconfig=hub-kubeconfig -n fleet-system
rm hub-kubeconfig
kubectl apply -k deploy
Create a secret in the Spoke cluster that contains the kubconfig file pointing to the hub and run your code against.
kubectl create namespace fleet-system
kubectl delete secret hub-kubeconfig-secret -n fleet-system
kubectl create secret generic hub-kubeconfig-secret --from-file=kubeconfig=/Users/ryanzhang/.kube/hub -n fleet-system
go run cmd/workcontroller/workcontroller.go --work-namespace=default --hub-kubeconfig-secret=hub-kubeconfig-secret -v 5 -add_dir_header
Create a secret in the cluster that contains the kubconfig file pointing to itself. Run the feature code against it.
kubectl create namespace fleet-system
kubectl delete secret hub-kubeconfig-secret -n fleet-system
kubectl create secret generic hub-kubeconfig-secret --from-file=kubeconfig=/Users/ryanzhang/.kube/member-a -n fleet-system
go run cmd/workcontroller/workcontroller.go --work-namespace=default --hub-kubeconfig-secret=hub-kubeconfig-secret -v 5 -add_dir_header
run the test in another window
export KUBECONFIG=kubeconfig=/Users/ryanzhang/.kube/member-a
go test . -test.v -ginkgo.v
On the Hub
cluster terminal, run the following command:
kubectl apply -f examples/example-work.yaml
On the Spoke
cluster terminal, run the following commands:
$ kubectl -n default get deploy test-nginx
NAME READY UP-TO-DATE AVAILABLE AGE
test-nginx 2/2 2 2 32s
$ kubectl -n default get service test-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
test-nginx ClusterIP 10.96.96.136 <none> 80/TCP 46s
On the Hub
cluster terminal, run the following command:
kubectl apply -f examples/example-work-modify.yaml
Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.