kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

⚠️ Moving Control Plane Provider and Infra Provider #57

Closed christopherhein closed 3 years ago

christopherhein commented 3 years ago

This PR separates the Control Plane Provider from the Infrastructure provider allowing them to be deployed separately which will help us down the line if we end up wanting to support #44 but also helps us to better the experience for clusterctl once we get our first release out to help fulfill #54.

Testable Steps

Create kind cluster

kind create cluster

Install cert-manager

kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.3.1/cert-manager.yaml

Clone CAPI and Deploy Dev release

We need to deploy the unreleased version of CAPI for v1alpha4 API support.

git clone git@github.com:kubernetes-sigs/cluster-api.git
cd cluster-api
make release-manifests
# change feature flags on core
sed -i'' -e 's@- --feature-gates=.*@- --feature-gates=MachinePool=false,ClusterResourceSet=true@' out/core-components.yaml
kubectl apply -f out/core-components.yaml

Create Docker Images, Manifests and Load Images

export PULL_POLICY=Never
export TAG=dev
make docker-build release-manifests
kind load docker-image gcr.io/cluster-api-nested-controller-amd64:dev
kind load docker-image gcr.io/nested-controlplane-controller-amd64:dev

Deploy CAPN

kubectl apply -f out/cluster-api-provider-nested-components.yaml

Apply Sample Cluster

kubectl apply -f config/samples/

Get KUBECONFIG

clusterctl get kubeconfig cluster-sample > kubeconfig

Port Forward

In a separate shell, you will need to port-forward the apiserver service.

kubectl port-forward svc/cluster-sample-apiserver 6443:6443

Connect to Cluster

To use the KUBECONFIG without modification we first need to setup a host record for the apiserver service name, to do this we can append that to /etc/hosts

cat /etc/hosts
# Normal hosts file
127.0.0.1 cluster-sample-apiserver

Connect to the Cluster! 🎉

kubectl --kubeconfig kubeconfig get all -A

Related

Closes #45

Signed-off-by: Chris Hein me@chrishein.com

k8s-ci-robot commented 3 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christopherhein

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/master/OWNERS)~~ [christopherhein] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
christopherhein commented 3 years ago

/cc @vincepri we chatted about this before and we didn't get the first workable version out before we did this reorganization.

christopherhein commented 3 years ago

/assign @charleszheng44 @Fei-Guo

christopherhein commented 3 years ago

@charleszheng44 the description of this PR has most of the steps laid out for the initial tutorial, I didn't write these up in docs yet if you'd still like to do that for #52

Fei-Guo commented 3 years ago

LGTM

charleszheng44 commented 3 years ago

@charleszheng44 the description of this PR has most of the steps laid out for the initial tutorial, I didn't write these up in docs yet if you'd still like to do that for #52

Yes. I will try this out and write up the tutorial for the first release.

charleszheng44 commented 3 years ago

/lgtm