An example Kubernetes CLI using SwiftkubeClient implementing a tiny subset of the functionality for demo purposes.
This example demonstrates using SwiftkubeClient and
SwiftkubeModel to communicate with API server. The implemented API mimicks kubectl
.
- Load Kubernetes objects
- by name in a given namespace
- list objects in all namespaces
- Create Kubernetes objects
-
ConfigMaps
via--from-literal
and--from-file
-
Deployments
with a givenimage
-
- Apply object manifests from a file
- Server version information
- Server API Versions
- Server API Resources
SwiftkubeClient
detects the current local kubeconfig
automatically, i.e. if you've got a kubeconfig
under
~/.kube/config
it will be picked up and used for all swiftkubectl
calls.
Clone this repository and run:
$ swift build
$ .build/debug/swiftkubectl -h
OVERVIEW: Swiftkube-c-t-l
An example kubernetes cli using SwiftkubeClient implementing
a tiny subset of the functionality for demo purposes.
USAGE: swiftkubectl <subcommand>
OPTIONS:
-h, --help Show help information.
SUBCOMMANDS:
apply Apply a configuration to a resource by filename.
get Display one or many resources.
create Create a resource.
version Print the client and server version information for the current context.
api-versions Print the supported API versions on the server, in the form of 'group/version'.
api-resources Print the supported API resources on the server.
See 'swiftkubectl help <subcommand>' for detailed help.