Skip to content

coxedge/cluster-api-provider-coxedge

Repository files navigation

Kubernetes Cluster API Provider Cox

Kubernetes-native declarative infrastructure for Cox Edge.

What is the Cluster API Provider Cox Edge

The Cluster API brings declarative, Kubernetes-style APIs to cluster creation, configuration and management. The API itself is shared across multiple cloud providers allowing for true Cox Edge hybrid deployments of Kubernetes.

Compatibility with Cluster API

This provider's versions are compatible with the following versions of Cluster API:

Cluster API v1alpha4 (v0.4) Cluster API v1beta1 (v1.x)
Cox Edge v1beta1 (v0.5.x)

Prerequisites

  • GO version should be greater than or equal to 1.13

  • Ensure that you have make installed.

  • Ensure that you have the latest git version.

  • You will need to update your clusterctl config to be able to discover the provider, which is located by default ~/.cluster-api/clusterctl.yaml.

providers:
  # Add the cox infrastructure provider to the clusterctl config for discovery
  - name: coxedge
    type: InfrastructureProvider
    url: https://github.com/coxedge/cluster-api-provider-coxedge/releases/v0.5.5/infrastructure-components.yaml
  • Ensure that the Cox provider has the required credentials. You will need to add your credentials in the examples/coxcluster.yaml file.
stringData:
  COX_API_KEY: <YOUR API KEY>
  COX_SERVICE: edge-service
  COX_ENVIRONMENT: <ENVIRONMENT NAME>
  # By default COX_ORGANIZATION is commented. If you have an Organization ID, then and only then uncomment the same and fill in the ID.
  # COX_ORGANIZATION: <ORGANIZATION ID>
      sshAuthorizedKeys:
        - # Please fill in your ssh key as this is a required field.
  • Ensure your nodes persistent volumes are created with appropriate size and mount path in in the examples/coxcluster.yaml file at lines 194 through 196 for master nodes and 255 through 257 for workers. Note max 7 volumes can be created with max size of 1000GB each.
      persistentStorages:
        - path: "/var/lib/mnt1"
          size: "10"

Installation

For Development

  • Creating a kind cluster

kind create cluster
  • Initialize the management cluster

clusterctl init --infrastructure coxedge
  • Cluster creation

kubectl apply -f examples/coxcluster.yaml

NOTE: If you make changes to the CAPI Provider and want to test them locally, then the below steps will help you in accomplishing this. These are optional steps and can be ignored.

  • Building Image [OPTIONAL]

Change REGISTRY and IMAGE_NAME according to your setup

make docker-build && make docker-push
  • Cluster creation [OPTIONAL]

make release-manifests-clusterctl

kubectl apply -f build/releases/infrastructure-cox/latest/infrastructure-components.yaml

kubectl apply -f examples/coxcluster.yaml

NOTE: You will need to install Pod Security Policies and CNI before using/accessing the cluster.

  • Exporting Kubeconfig and moving to the target cluster

clusterctl get kubeconfig <cluster-name> -n default > coxcluster.kubeconfig

export KUBECONFIG=coxcluster.kubeconfig
  • Installing Pod Security Policies and CNI

NOTE: Please ensure that you are on your target cluster before executing the below commands for installing CNI and PodSecurityPolicies.

kubectl apply -f examples/podsecuritypolicies.yaml

kubectl apply -f examples/cni.yaml
  • Installing CSI [OPTIONAL]

For installing CSI, please refer to Longhorn installation guide.

Getting cluster info

  • View cluster status

kubectl get cluster
  • At glance view of cluster and resources

clusterctl describe cluster <cluster_name>

For Maintainers

Document providing steps to publish a release is provided here.