roles:
- rabbitmq
- - cAdvisor
+ - cadvisor
- prometheus
- helm
- k3s
- rabbitmq
- prometheus
- kubeconfig
+ - cadvisor
- hosts: mepautomate
become: yes
+++ /dev/null
-image:
- repository: unibaktr/cadvisor
- tag: v0.36.0
+++ /dev/null
-# Copyright 2020 Huawei Technologies Co., Ltd.
-#
-# 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.
-
----
-- name: check if cadvisor is already installed
- shell:
- cmd: helm status cadvisor
- register: result
- failed_when: false
- no_log: True
-
-- debug:
- msg: cAdvisor is already present
- when: result.rc == 0
-
-- meta: end_play
- when: result.rc == 0
-
-- name: "Add helm repo"
- command: helm repo add code-chris https://code-chris.github.io/helm-charts
- when: result is failed
-
-- name: "Update helm repo"
- command: helm repo update
- when: result is failed
-
-- name: copy values.yaml to host
- copy:
- src: values.yaml
- dest: /tmp/cAdvisor/
- when: result is failed
-
-- name: "Installing cAdvisor"
-# yamllint disable rule:line-length
- command: helm install cadvisor code-chris/cadvisor -f /tmp/cAdvisor/values.yaml
-# yamllint disable rule:line-length
- when: result is failed
--- /dev/null
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# 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.
+
+
+# cadvisor pod
+---
+apiVersion: v1
+kind: Pod
+metadata:
+ name: cadvisor
+ namespace: default
+ labels:
+ app: cadvisor
+ annotations:
+ seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
+spec:
+ containers:
+ - image: unibaktr/cadvisor:v0.36.0
+ imagePullPolicy: Always
+ name: cadvisor-pod
+ ports:
+ - containerPort: 8080
+ hostPort: 8081
+ protocol: TCP
+ resources:
+ requests:
+ memory: 200Mi
+ cpu: 150m
+ limits:
+ memory: 2000Mi
+ cpu: 300m
+ volumeMounts:
+ - mountPath: /rootfs
+ name: rootfs
+ readOnly: true
+ # yamllint disable-line rule:key-duplicates
+ volumeMounts:
+ - mountPath: /var/run
+ name: varrun
+ readOnly: true
+ # yamllint disable-line rule:key-duplicates
+ volumeMounts:
+ - mountPath: /sys
+ name: sys
+ readOnly: true
+ # yamllint disable-line rule:key-duplicates
+ volumeMounts:
+ - mountPath: /var/lib/docker
+ name: varlibdocker
+ readOnly: true
+ # yamllint disable-line rule:key-duplicates
+ volumeMounts:
+ - mountPath: /dev/disk
+ name: devdisk
+ readOnly: true
+ terminationGracePeriodSeconds: 30
+ volumes:
+ - name: rootfs
+ hostPath:
+ path: /
+ # yamllint disable-line rule:key-duplicates
+ volumes:
+ - name: varrun
+ hostPath:
+ path: /var/run
+ # yamllint disable-line rule:key-duplicates
+ volumes:
+ - name: sys
+ hostPath:
+ path: /sys
+ # yamllint disable-line rule:key-duplicates
+ volumes:
+ - name: varlibdocker
+ hostPath:
+ path: /var/lib/docker
+ # yamllint disable-line rule:key-duplicates
+ volumes:
+ - name: devdisk
+ hostPath:
+ path: /dev/disk
--- /dev/null
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# 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.
+
+---
+- name: copy deploy folder to mep node to install mepserver
+ copy:
+ src: dep.yaml
+ dest: /tmp/cadvisor/
+
+- name: Installation of cadvisor
+ shell:
+ cmd: kubectl apply -f /tmp/cadvisor/dep.yaml
+ ignore_errors: 'True'
# limitations under the License.
---
-
-- name: check if cadvisor is installed before deleting
+- name: check if cadvisor is installed before removing
shell:
- cmd: helm status cadvisor
+ cmd: kubectl get pods | grep cadvisor
register: result
- failed_when: false
- no_log: True
-
-- debug:
- msg: cAdvisor is not present
- when: result.rc == 2
-
-- meta: end_play
- when: result.rc == 2
+ ignore_errors: 'True'
-- name: "If cAdvisor present, then list helm ls"
- command: helm ls
- when: result is succeeded
-
-- name: "Uninstall cadvisor"
- command: helm delete cadvisor
+- name: Uninstallation of cadvisor
+ shell:
+ cmd: kubectl delete -f /tmp/cadvisor/dep.yaml
when: result is succeeded
+ ignore_errors: 'True'