operator-sdk

operator-sdk

Development kit for building Kubernetes extensions and tools.

Synopsis

Development kit for building Kubernetes extensions and tools.

Provides libraries and tools to create new projects, APIs and controllers. Includes tools for packaging artifacts into an installer container.

Typical project lifecycle:

  • initialize a project:

    operator-sdk init –domain example.com –license apache2 –owner “The Kubernetes authors”

  • create one or more a new resource APIs and add your code to them:

    operator-sdk create api –group –version –kind

Create resource will prompt the user for if it should scaffold the Resource and / or Controller. To only scaffold a Controller for an existing Resource, select “n” for Resource. To only define the schema for a Resource without writing a Controller, select “n” for Controller.

After the scaffold is written, api will run make on the project.

  1. operator-sdk [flags]

Examples

  1. # Initialize your project
  2. operator-sdk init --domain example.com --license apache2 --owner "The Kubernetes authors"
  3. # Create a frigates API with Group: ship, Version: v1beta1 and Kind: Frigate
  4. operator-sdk create api --group ship --version v1beta1 --kind Frigate
  5. # Edit the API Scheme
  6. nano api/v1beta1/frigate_types.go
  7. # Edit the Controller
  8. nano controllers/frigate_controller.go
  9. # Install CRDs into the Kubernetes cluster using kubectl apply
  10. make install
  11. # Regenerate code and run against the Kubernetes cluster configured by ~/.kube/config
  12. make run

Options

  1. -h, --help help for operator-sdk
  2. --verbose Enable verbose logging

SEE ALSO

Last modified December 5, 2020: *: upgrade kubebuilder, add go/v3-alpha to the list of available plugins (#4282) (1ad6ff3d)