Brian's cheatsheet for Helm commands: K8S / helm basic commands for ONAP integration
#ONAP installation from Windriver jumpserver. Git clone integration repo or pull the latest from repo first, then#git pull in OOM repo
Code Block |
---|
Code Block |
---|
title | Update a project Chart |
---|
|
root@onap-oom-rancher:~# cd oom/kubernetes
root@onap-oom-rancher:~/oom/kubernetes# vi robot/resources/config/eteshare/config/integration_robot_properties.py
root@onap-oom-rancher:~/oom/kubernetes# make robot
root@onap-oom |
xuyang11@pod-onap-01-vjhost:~$ cd integration/
xuyang11@pod-onap-01-vjhost:~/src/integration$ git pull
xuyang11@pod-onap-01-vjhost:~/src/integration$ source deployment/heat/onap-oom/env/windriver/Integration-SB-XX-openrc
xuyang11@pod-onap-01-vjhost:~/src/integration$ cd deployment/heat/onap-oom
xuyang11@pod-onap-01-vjhost:~/src/integration/deployment/heat/onap-oom$ ./scripts/deploy.sh -m docker-manifest-staging.csv -q env/windriver/onap-oom.env
|
#Update a project configuration or simply restart a project. For example, change GLOBAL_AAI_USERNAME parameter in integration_robot_properties.py
|
Yangs-MacBook-Air:src yang$ git clone "https://gerrit.onap.org/r/oom"
Yangs-MacBook-Air:src yang$ cd oom
Yangs-MacBook-Air:oom yang$ git submodule update --init --recursive
Yangs-MacBook-Air:oom yang$ git pull
|
#find all unreleased ONAP images used by OOM charts
Code Block |
---|
title | Unrelease image list in OOM |
---|
|
Yangs-MacBook-Air:oom yang$ find . -name 'values.yaml' -exec grep -Hn image {} \; | grep onap | grep image | grep -E -i "staging|snapshot" | grep -v helm | sort
./kubernetes/aai/charts/aai-elasticsearch/values.yaml:22:image: onap/elasticsearch-sg:1.4-STAGING-latest
|
#ONAP installation from Windriver jumpserver. Git clone integration repo or pull the latest from repo first, then
Code Block |
---|
|
xuyang11@pod-onap-01-vjhost:~$ cd integration/
xuyang11@pod-onap-01-vjhost:~/src/integration$ git pull
xuyang11@pod-onap-01-vjhost:~/src/integration$ source deployment/heat/onap-oom/env/windriver/Integration-SB-XX-openrc
xuyang11@pod-onap-01-vjhost:~/src/integration$ cd deployment/heat/onap-oom
xuyang11@pod-onap-01-vjhost:~/src/integration/deployment/heat/onap-oom$ nohup ./scripts/deploy.sh -m docker-manifest-staging.csv -q env/windriver/onap-oom.env &
or
xuyang11@pod-onap-01-vjhost:~/src/integration/deployment/heat/onap-oom$ nohup ./scripts/deploy.sh -m docker-manifest.csv -q env/windriver/onap-oom.env & |
#Update a project configuration or simply restart a project. For example, change GLOBAL_AAI_USERNAME parameter in integration_robot_properties.py
Code Block |
---|
title | Update a project Chart |
---|
|
root@onap-oom-rancher:~# cd oom/kubernetes
root@onap-oom-rancher:~/oom/kubernetes# helm list -a
root@onap-oom-rancher:~/oom/kubernetes# helm delete dev-robot --purge
root@onap-oom-rancher:~/oom/kubernetes# ~/integration/deployment/heat/onap-oom/scripts/cleanup.sh robot #clean up any resource used by robot
root@onap-oom-rancher:~/oom/kubernetes# rm -rf /dockerdata-nfs/dev-robot #clean up the persistent data
root@onap-oom-rancher:~/oom/kubernetes# vi robot/resources/config/eteshare/config/integration_robot_properties.py #make change to charts
root@onap-oom-rancher:~/oom/kubernetes# make robot
root@onap-oom-rancher:~/oom/kubernetes# make onap
root@onap-oom-rancher:~/oom/kubernetes# helm deploy dev local/onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --namespace onap
|
#Undeploy the whole ONAP (not tested yet) - use 'kubectl -n onap get all' and then delete any dangling parts like below
Code Block |
---|
|
root@rancher: helm undeploy dev --purge
root@rancher: kubectl -n onap get all
root@rancher: kubectl -n onap delete services --all
root@rancher: kubectl -n onap delete pv --all
root@rancher: kubectl -n onap delete pvc --all
root@rancher: kubectl -n onap delete secrets --all
root@rancher: kubectl -n onap delete clusterrolebinding --all
root@rancher: kubectl -n onap delete statefulsets --all
root@rancher: kubectl -n onap delete deployments --all
root@rancher: kubectl -n onap delete job --all
root@rancher: kubectl -n onap delete pods --all
root@rancher: kubectl -n onap get all
|
#Deploy and undeploy a chart. See OOM Helm (un)Deploy plugins
Code Block |
---|
root@oom-rancher:~/oom/kubernetes# helm deploy dev-sdc local/onap --namespace onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --verbose
|
If it fails, try to delete the release, and deploy again
Code Block |
---|
root@oom-rancher:~/oom/kubernetes# helm deploy dev-sdc local/onap --namespace onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --verbose
fetching local/onap
Error: UPGRADE FAILED: "dev-sdc" has no deployed releases
root@oom-rancher:~/oom/kubernetes# helm makedel onap dev-sdc root@onap-oom-rancher:~/oom/kubernetes# helm list -a
root@onap-oom-purge
release "dev-sdc" deleted
root@oom-rancher:~/oom/kubernetes# helm deletedeploy dev-robotsdc local/onap --purgenamespace onap root@onap-oom-rancher:~/oom/kubernetes# helm list -a |grep robot
# check and delete any resource left for the project, i.e. pv, pvc, statefulset, configmap, service, deployment, secret, etc
root@onap-oom-f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --verbose
fetching local/onap
Release "dev-sdc" does not exist. Installing it now.
NAME: dev-sdc
|
#Another way to install one chart (deprecated due to memory size limit of configmap)
Code Block |
---|
|
root@oom-rancher:~/oom/kubenetes# helm delete --purge dev-sdc
root@oom-rancher:~/oom/kubernetes#kubenetes# helm deploy devinstall local/onapsdc --namespace onap --name dev-sdc -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml
--namespace onap
root@onap-oom-rancher:~/oom/kubernetes# kubectl -n onap get pod |grep robot
dev-robot-robot-6f5b8b968f-7gwz9 1/1 Running 0 32s
|
...
#Edit deployment. Very useful to change deployment parameters, like docker image version so you can pick a previous working docker image. K8S will restart the pod after the change is made
Code Block |
---|
Code Block |
---|
|
root@onap-oom-rancher:~# kubectl edit deploy -n onap dev-sdc-sdc-fe |
helm delete --purge dev-sdc
helm install dev-sdc local/sdc --namespace onap |
#Edit deployment. Very useful to change deployment parameters, like docker image version so you can pick a previous working docker image. K8S will restart the pod after the change is made
|
root@onap-oom-rancher:~# kubectl edit deploy -n onap dev-sdc-sdc-fe |
#Edit statefulset. Sometimes image version is in statefulset, use describe pod command and search for Controlled by keyword. You need to bounce pod after change
Code Block |
---|
root@oom-rancher:~/oom/kubernetes# kubectl -n onap edit statefulset dev-appc-appc
|
#Find AAI endpoint IP and port. IP can be ANY cluster node IP, and port is 30233
...
Code Block |
---|
root@oom-rancher:~# kubectl -n onap get configMap dev-so-so-sdc-controller-app-configmap -o yaml
apiVersion: v1
data:
override.yaml: |
# Copyright © 2018 AT&T USA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
aai:
auth: 2630606608347B7124C244AB0FE34F6F
server:
port: 8085
spring:
security:
usercredentials:
-
username: asdc
password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
role: Asdc-Client
-
username: mso_admin
password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
role: ACTUATOR
mso:
msoKey: 07a7159d3bf51a0e53be7a8f89699be7
logPath: ./logs/sdc
catalog:
db:
spring:
endpoint: http://so-catalog-db-adapter.onap:8082
db:
auth: Basic YnBlbDpwYXNzd29yZDEk
site-name: onapheat
aai:
endpoint: https://aai.onap:8443
asdc-connections:
asdc-controller1:
user: mso
consumerGroup: sdc-OpenSource-Env1
consumerId: sdc-COpenSource-Env11
environmentName: AUTO
asdcAddress: sdc-be.onap:8443
password: 613AF3483E695524F9857643B697FA51C7A9A0951094F53791485BF3458F9EADA37DBACCCEBD0CB242B85B4062745247
pollingInterval: 60
pollingTimeout: 60
relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
activateServerTLSAuth: false
keyStorePassword:
keyStorePath:
watchDogTimeout: 300
isFitlerInEmptyResources: true
... ...
|
#Edit ConfigMap - Change overrides.yaml on running deploye.g. chaning user name or password. Then you need to delete the pod and let k8s restart the pod to take the new values
Code Block |
---|
root@oom-rancher:~# kubectl -n onap edit configmap dev-so-so-bpmn-infra-app-configmap
## Edit something in the config
## Delete Pod and let kubernetes respawn with new config
root@oom-rancher:~# kubectl -n onap delete pod dev-so-so-bpmn-infra-5887f8c6c8-jkk7c |
...
Code Block |
---|
## Replace service name below
root@oom-rancher:~# kubectl patch svc -n onap so-openstack-adapter --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'
## get nodeport assigned by kubernetes
root@oom-rancher:~# kubectl -n onap get service | grep so-openstack-adapter
so-openstack-adapter NodePort 10.43.105.9 <none> 8087:32715/TCP |
#Generate encrypted openstack password
Code Block |
---|
>echo -n <tenant_password>| openssl aes-128-ecb -e -K aa3871669d893c7fb8abbcda31b88b4f -nosalt | xxd -c 256 -p
|