.. _cli: Command Line Interface ---------------------- The K9 CLI is designed to allow clusters to be created quickly and easily. Most commands are meant to run easily with opinionated defaults. The typical process for creating a cluster will be as follows: #. cd into a directory where you will hold the CloudFormation files #. k9 create templates #. Edit the cluster-config.yml file. Edit cfm files as needed. #. k9 create cluster This will create stacks for certificates (which must be manually approved), the VPC, the EKS control plane, the EKS workers, and RDS. Next, standard apps EFK, Prometheus, and Grafana will be deployed to the cluster. If the clusterName provided in k9-config.yml contains 'cicd', standard cicd apps Jenkins, SonarQube, and Anchore will be deployed. This directory can be used to recreate stacks exactly, so you may wish to keep it in some sort of version control. The values from cluster-config.yml will be wired into the cfm files when the stacks are made. Commands ######## These are available command line commands from the k9 library. They are called with the format 'k9 command resource' .. autoclass:: k9.cli.CommandExecution .. autofunction:: k9.cli.CommandExecution.create_project .. autofunction:: k9.cli.CommandExecution.create_templates .. autofunction:: k9.cli.CommandExecution.create_cluster .. autofunction:: k9.cli.CommandExecution.deploy_service .. autofunction:: k9.cli.CommandExecution.deploy_ui .. autofunction:: k9.cli.CommandExecution.delete_cluster .. autofunction:: k9.cli.CommandExecution.delete_monitoring Create Cluster Functions ######################## These are the functions called by the create cluster command line command. .. autofunction:: k9.cluster_init.create_cluster - create_cluster() uses the atomic-cloud.cluster.create_cluster() to create AWS CloudFormation stacks based on the k9-config.yml and CloudFormation templates in the directory the command was run from. - After the stacks have been created, it will call install_standard_apps() and then if 'cicd' is present in the clusterName, it will call create_cicd(). - Once this is all complete, there will be a fully complete cluster ready for your application deployment. .. autofunction:: k9.cluster_init.install_standard_apps - install_standard_apps() will deploy EFK, Prometheus, and Grafana using the SimonComputing helm charts. .. autofunction:: k9.cluster_init.create_cicd - create_cicd() will deploy Jenkins, SonarQube, and Anchore using the SimonComputing helm charts. - SonarQube and Anchore require databases before installing the helm chart, so create_app_database will be used to make the databases for these two apps. - Next, kubectl must be configured to connect to the cluster and create the cicd namespace. - Then a PersistentVolumeClaim will be created for the Jenkins deployment. We keep this separate from the Jenkins helm chart so that we can uninstall and reinstall Jenkins without losing data. - Finally, the helm charts will be deployed with install_jenkins(), install_sonarqube(), and install_anchore(). .. autofunction:: k9.cluster_init.install_efk .. autofunction:: k9.cluster_init.install_prometheus .. autofunction:: k9.cluster_init.install_grafana .. autofunction:: k9.cluster_init.install_jenkins .. autofunction:: k9.cluster_init.install_sonarqube Upcoming: install_anchore