diff --git a/advanced-cluster-management.md b/advanced-cluster-management.md new file mode 100644 index 0000000000000000000000000000000000000000..706f69487533df9c0a8342f0dae282b8763eaa29 --- /dev/null +++ b/advanced-cluster-management.md @@ -0,0 +1,187 @@ +# Advanced cluster management + +## Advanced cluster management with OSM client + +This guide contains OSM client commands to operate infrastructure and applications following the new declarative framework introduced in Release SIXTEEN. + +### OSM client initialization + +```bash +export OSM_HOSTNAME=$(kubectl get -n osm -o jsonpath="{.spec.rules[0].host}" ingress nbi-ingress) +echo "OSM_HOSTNAME: $OSM_HOSTNAME" +``` + +### VIM/Cloud account operations + +#### VIM/Cloud account registration + +Example for Azure: + +```bash +export OSM_CREDS_FOLDER="${HOME}/vims" +source ${OSM_CREDS_FOLDER}/azure-env.rc +osm vim-create --name azure-site --account_type azure \ + --auth_url http://www.azure.com \ + --user "$AZURE_CLIENT_ID" --password "$AZURE_SECRET" --tenant "$AZURE_TENANT" \ + --description "AZURE site" \ + --creds ${OSM_CREDS_FOLDER}/azure-credentials.json \ + --config "{region_name: westeurope, resource_group: '', subscription_id: '$AZURE_SUBSCRIPTION_ID', vnet_name: 'osm', flavors_pattern: '^Standard'}" +``` + +File `${OSM_CREDS_FOLDER}/azure-env.rc`: + +```bash +export AZURE_CLIENT_ID="**********************************" +export AZURE_TENANT="**********************************" +export AZURE_SECRET="**********************************" +export AZURE_SUBSCRIPTION_ID="**********************************" +``` + +File `${OSM_CREDS_FOLDER}/azure-credentials.json`: + +```json +{ + "clientId": "{************************************}", + "clientSecret": "************************************", + "subscriptionId": "************************************", + "tenantId": "************************************", + "activeDirectoryEndpointUrl": "https://login.microsoftonline.com", + "resourceManagerEndpointUrl": "https://management.azure.com/", + "activeDirectoryGraphResourceId": "https://graph.windows.net/", + "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", + "galleryEndpointUrl": "https://gallery.azure.com/", + "managementEndpointUrl": "https://management.core.windows.net/" +} +``` + +The JSON credentials file corresponds to the service principal credentials obtained during the service principal creation: + +```bash +az ad sp create-for-rbac --role Contributor --scopes /subscriptions//resourceGroups/ +``` + +#### VIM/Cloud account deletion + +```bash +osm vim-delete azure-site +``` + +### Cluster operations + +#### Cluster creation + +```bash +CLUSTER_NAME=cluster1 +CLUSTER_VM_SIZE=Standard_D2_v2 +CLUSTER_NODES=1 +REGION_NAME=northeurope +VIM_ACCOUNT=azure-site +RESOURCE_GROUP= +KUBERNETES_VERSION="1.30" +osm cluster-create --node-count ${CLUSTER_NODES} --node-size ${CLUSTER_VM_SIZE} --version ${KUBERNETES_VERSION} --vim-account ${VIM_ACCOUNT} --description "Cluster1" ${CLUSTER_NAME} --region-name ${REGION_NAME} --resource-group ${RESOURCE_GROUP} +``` + +```bash +osm cluster-list +``` + +When the cluster is created, the field `resourceState` should be `READY`. + +#### Getting kubeconfig + +Once the cluster is ready, you can get the credentials in this way: + +```bash +osm cluster-show cluster1 -o jsonpath='{.credentials}' | yq -P +# Save them in a file +osm cluster-show cluster1 -o jsonpath='{.credentials}' | yq -P > ~/kubeconfig-cluster1.yaml +# Test it +export KUBECONFIG=~/kubeconfig-mydemo.yaml +kubectl get nodes +``` + +In case credentials are renewed by the cloud policy, credentials can be obtained using any of the + +```bash +osm cluster-get-credentials cluster1 +``` + +#### Cluster registration + +This should be run over a cluster that was not created by OSM: + +```bash +CLUSTER_NAME=cluster2 +VIM_ACCOUNT=azure-site +osm cluster-register --creds ~/kubeconfig-${CLUSTER_NAME}.yaml --vim ${VIM_ACCOUNT} --description "My existing K8s cluster" ${CLUSTER_NAME} +``` + +#### Cluster scale + +```bash +CLUSTER_NAME=cluster1 +osm cluster-scale ${CLUSTER_NAME} --node-count 2 +``` + +### OKA operations + +#### OKA addition + +```bash +# git clone --recursive https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git +export OSM_PACKAGES_FOLDER="${HOME}/osm-packages" +export OKA_FOLDER="${OSM_PACKAGES_FOLDER}/oka/apps" +osm oka-add jenkins ${OKA_FOLDER}/jenkins --description jenkins --profile-type app-profile +osm oka-add testapp ${OKA_FOLDER}/testapp --description testapp --profile-type app-profile +osm oka-add testacme ${OKA_FOLDER}/testacme --description testacme --profile-type app-profile +``` + +```bash +osm oka-list +``` + +When the OKA is created, the field `resourceState` should be `READY`. + +#### OKA deletion + +```bash +osm oka-delete testapp +osm oka-delete testacme +osm oka-delete jenkins +``` + +### Profile operations + +#### Listing profiles + +```bash +osm profile-list +``` + +### KSU operations + +#### KSU creation from OKA + +You must specify the destination profile: + +```bash +export OSM_PACKAGES_FOLDER="${HOME}/osm-packages" +export OKA_FOLDER="${OSM_PACKAGES_FOLDER}/oka/apps" +osm ksu-create --ksu testapp --profile mydemo --profile-type app-profile --oka testapp --params ${OKA_FOLDER}/testapp-params.yaml +osm ksu-create --ksu testacme --profile mydemo --profile-type app-profile --oka testacme --params ${OKA_FOLDER}/testacme-params.yaml +osm ksu-create --ksu jenkins --description "Jenkins" --profile mydemo --profile-type app-profile --oka jenkins --params ${OKA_FOLDER}/jenkins-params.yaml +``` + +```bash +osm ksu-list +``` + +When the KSU is created, the field `resourceState` should be `READY`. + +#### KSU deletion + +```bash +osm ksu-delete testapp +osm ksu-delete testacme +osm ksu-delete jenkins +``` diff --git a/index.md b/index.md index 74087da9dd5fd8c285c6e0456713e191f90aadd4..0268f87cb933b9153ccffb1c0536d976d1850ca0 100644 --- a/index.md +++ b/index.md @@ -10,6 +10,8 @@ - How to setup a VIM to use it from OSM 5. [OSM Usage](05-osm-usage.md) - Learn how to run common OSM operations +5. [Advanced cluster management](advanced-cluster-management.md) + - Learn how to run new OSM operations for advanced cluster management 6. [OSM platform configuration](06-osm-platform-configuration.md) - Setting up your OSM 7. [What to read next](07-what-to-read-next.md) diff --git a/index.rst b/index.rst index 23f256aaa16dc3755e6e659903ad3e144e7d5782..167a893671e9bce33a62101b4c74edb52ebb6ae9 100644 --- a/index.rst +++ b/index.rst @@ -17,6 +17,7 @@ Welcome to Open Source MANO's documentation! 03-installing-osm 04-vim-setup 05-osm-usage + advanced-cluster-management 06-osm-platform-configuration 07-what-to-read-next 08-how-to-contribute-to-docs diff --git a/navigation.md b/navigation.md index a9678f4b00c22cbfa666fd63307e46b68b709c23..9f39d297097d5613c19892c88ba15171ecf8dc6f 100644 --- a/navigation.md +++ b/navigation.md @@ -7,6 +7,7 @@ [Installing OSM](03-installing-osm.md) [VIM(s) setup](04-vim-setup.md) [OSM Usage](05-osm-usage.md) +[Advanced cluster management](advanced-cluster-management.md) [OSM platform configuration](06-osm-platform-configuration.md) [What to read next](07-what-to-read-next.md) [How to contribute to documentation](08-how-to-contribute-to-docs.md)