diff --git a/CreaCluster/50-creaCalico.sh b/CreaCluster/50-creaCalico.sh index c7dd2da8..60be27c5 100755 --- a/CreaCluster/50-creaCalico.sh +++ b/CreaCluster/50-creaCalico.sh @@ -1,3 +1,5 @@ -kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml +#kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml +kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.3/manifests/tigera-operator.yaml + kubectl create -f ./custom-resources.yaml diff --git a/CreaCluster/65-instalaCertManager.sh b/CreaCluster/65-instalaCertManager.sh new file mode 100644 index 00000000..d0071e91 --- /dev/null +++ b/CreaCluster/65-instalaCertManager.sh @@ -0,0 +1,4 @@ +# Fuente: https://cert-manager.io/docs/installation/kubectl/ + +kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.1/cert-manager.yaml + diff --git a/CreaCluster/66-creaIngressController.sh b/CreaCluster/66-creaIngressController.sh new file mode 100644 index 00000000..f2c0583c --- /dev/null +++ b/CreaCluster/66-creaIngressController.sh @@ -0,0 +1,24 @@ +# Fuente: https://docs.k0sproject.io/v1.24.4+k0s.0/examples/nginx-ingress/ +kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.3/deploy/static/provider/baremetal/deploy.yaml +watch kubectl get pods -n ingress-nginx +kubectl get services -n ingress-nginx +kubectl -n ingress-nginx get ingressclasses +kubectl -n ingress-nginx annotate ingressclasses nginx ingressclass.kubernetes.io/is-default-class="true" + +echo "Intenta conectar: curl :" +echo "La dirección es la del servidor y el puerto NodePort el resultado de kubectl get services -n ingress-nginx" +echo "Como no hay ningún servicio configurado, dará 404 Not Found" + + +# crear pequeña app verificación + +kubectl apply -f app-verificacion.yaml + +# conectar (dirección y puerto igual que arriba) + +curl k8s-server:32478 -H 'Host: web.example.com' + +# resultado correcto: +# +#

It works!

+# diff --git a/CreaCluster/README.md b/CreaCluster/README.md index 967ca959..628e4a3b 100644 --- a/CreaCluster/README.md +++ b/CreaCluster/README.md @@ -8,3 +8,7 @@ https://blog.radwell.codes/2021/05/provisioning-single-node-kubernetes-cluster-u ## Como resetearlo https://www.techrunnr.com/how-to-reset-kubernetes-cluster/ + +## cert-manager + +Instrucciones en https://cert-manager.io/docs/installation/kubectl/ diff --git a/CreaCluster/Tests/test-resources.yaml b/CreaCluster/Tests/test-resources.yaml new file mode 100644 index 00000000..b15f9015 --- /dev/null +++ b/CreaCluster/Tests/test-resources.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: cert-manager-test +--- +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + name: test-selfsigned + namespace: cert-manager-test +spec: + selfSigned: {} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: selfsigned-cert + namespace: cert-manager-test +spec: + dnsNames: + - example.com + secretName: selfsigned-cert-tls + issuerRef: + name: test-selfsigned diff --git a/CreaCluster/app-verificacion.yaml b/CreaCluster/app-verificacion.yaml new file mode 100644 index 00000000..cfbecae9 --- /dev/null +++ b/CreaCluster/app-verificacion.yaml @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: web +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: web-server + namespace: web +spec: + selector: + matchLabels: + app: web + template: + metadata: + labels: + app: web + spec: + containers: + - name: httpd + image: httpd:2.4.53-alpine + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: web-server-service + namespace: web +spec: + selector: + app: web + ports: + - protocol: TCP + # port: 5000 + port: 80 + targetPort: 80 + type: LoadBalancer + externalIPs: + - 192.168.1.147 +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: web-server-ingress + namespace: web +spec: + ingressClassName: nginx + rules: + - host: web.example.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: web-server-service + port: + number: 5000 diff --git a/CreaCluster/cri-dockerd-0.2.6.amd64.tgz b/CreaCluster/cri-dockerd-0.2.6.amd64.tgz deleted file mode 100644 index d793ba1c..00000000 Binary files a/CreaCluster/cri-dockerd-0.2.6.amd64.tgz and /dev/null differ diff --git a/Enphase/extrae/app/extrae.sh b/Enphase/extrae/app/extrae.sh index 35bddff3..007d4e5b 100644 --- a/Enphase/extrae/app/extrae.sh +++ b/Enphase/extrae/app/extrae.sh @@ -33,11 +33,11 @@ pi_whLifetime=`echo $datos|jq .production[0].whLifetime` # Mostrar resultados # -#echo "Type: '$pi_type'" -#echo "activeCount: '$pi_activeCount'" -#echo "readingTime: '$pi_readingTime'" -#echo "wNow: '$pi_wNow'" -#echo "whLifetime: '$pi_whLifetime'" +echo "Type: '$pi_type'" +echo "activeCount: '$pi_activeCount'" +echo "readingTime: '$pi_readingTime'" +echo "wNow: '$pi_wNow'" +echo "whLifetime: '$pi_whLifetime'" # insertar en la tabla diff --git a/Enphase/extrae/app/formateado.json b/Enphase/extrae/app/formateado.json new file mode 100644 index 00000000..ca31d4d5 --- /dev/null +++ b/Enphase/extrae/app/formateado.json @@ -0,0 +1,86 @@ +{ + "production": [ + { + "type": "inverters", + "activeCount": 9, + "readingTime": 1696834651, + "wNow": 44, + "whLifetime": 280317 + }, + { + "type": "eim", + "activeCount": 1, + "measurementType": "production", + "readingTime": 1696834652, + "wNow": 57.714, + "whLifetime": 10746201.644, + "varhLeadLifetime": 0.064, + "varhLagLifetime": 2892249.348, + "vahLifetime": 12747185.198, + "rmsCurrent": 0.808, + "rmsVoltage": 228.763, + "reactPwr": 144.055, + "apprntPwr": 183.451, + "pwrFactor": 0.31, + "whToday": 12.644, + "whLastSevenDays": 106938.644, + "vahToday": 1312.198, + "varhLeadToday": 0.064, + "varhLagToday": 1263.348 + } + ], + "consumption": [ + { + "type": "eim", + "activeCount": 1, + "measurementType": "total-consumption", + "readingTime": 1696834652, + "wNow": 221.534, + "whLifetime": 15933238.526, + "varhLeadLifetime": 6361261.526, + "varhLagLifetime": -2714503.178, + "vahLifetime": 18970707.158, + "rmsCurrent": 3.189, + "rmsVoltage": 228.728, + "reactPwr": -304.033, + "apprntPwr": 729.311, + "pwrFactor": 0.3, + "whToday": 2254.526, + "whLastSevenDays": 96.526, + "vahToday": 5011.158, + "varhLeadToday": 4154.526, + "varhLagToday": 0 + }, + { + "type": "eim", + "activeCount": 1, + "measurementType": "net-consumption", + "readingTime": 1696834652, + "wNow": 163.82, + "whLifetime": 5188228.188, + "varhLeadLifetime": 6361261.59, + "varhLagLifetime": 177746.171, + "vahLifetime": 18970707.158, + "rmsCurrent": 2.38, + "rmsVoltage": 228.728, + "reactPwr": -448.088, + "apprntPwr": 544.464, + "pwrFactor": 0.3, + "whToday": 0, + "whLastSevenDays": 0, + "vahToday": 0, + "varhLeadToday": 0, + "varhLagToday": 0 + } + ], + "storage": [ + { + "type": "acb", + "activeCount": 0, + "readingTime": 0, + "wNow": 0, + "whNow": 0, + "state": "idle" + } + ] +} diff --git a/Enphase/extrae/app/production.json b/Enphase/extrae/app/production.json new file mode 100644 index 00000000..1b32592a --- /dev/null +++ b/Enphase/extrae/app/production.json @@ -0,0 +1 @@ +{"production":[{"type":"inverters","activeCount":9,"readingTime":1696834651,"wNow":44,"whLifetime":280317},{"type":"eim","activeCount":1,"measurementType":"production","readingTime":1696834652,"wNow":57.714,"whLifetime":10746201.644,"varhLeadLifetime":0.064,"varhLagLifetime":2892249.348,"vahLifetime":12747185.198,"rmsCurrent":0.808,"rmsVoltage":228.763,"reactPwr":144.055,"apprntPwr":183.451,"pwrFactor":0.31,"whToday":12.644,"whLastSevenDays":106938.644,"vahToday":1312.198,"varhLeadToday":0.064,"varhLagToday":1263.348}],"consumption":[{"type":"eim","activeCount":1,"measurementType":"total-consumption","readingTime":1696834652,"wNow":221.534,"whLifetime":15933238.526,"varhLeadLifetime":6361261.526,"varhLagLifetime":-2714503.178,"vahLifetime":18970707.158,"rmsCurrent":3.189,"rmsVoltage":228.728,"reactPwr":-304.033,"apprntPwr":729.311,"pwrFactor":0.3,"whToday":2254.526,"whLastSevenDays":96.526,"vahToday":5011.158,"varhLeadToday":4154.526,"varhLagToday":0.0},{"type":"eim","activeCount":1,"measurementType":"net-consumption","readingTime":1696834652,"wNow":163.82,"whLifetime":5188228.188,"varhLeadLifetime":6361261.59,"varhLagLifetime":177746.171,"vahLifetime":18970707.158,"rmsCurrent":2.38,"rmsVoltage":228.728,"reactPwr":-448.088,"apprntPwr":544.464,"pwrFactor":0.3,"whToday":0,"whLastSevenDays":0,"vahToday":0,"varhLeadToday":0,"varhLagToday":0}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]} diff --git a/Enphase/precios/app/pillaPrecios.sh b/Enphase/precios/app/pillaPrecios.sh index 789a7e40..019f365d 100644 --- a/Enphase/precios/app/pillaPrecios.sh +++ b/Enphase/precios/app/pillaPrecios.sh @@ -21,6 +21,7 @@ echo $datos|jq -c -r '.[]' | while read linea; do #echo "insert into precios (date,ischeap,isunderavg,price,units) values('$fechayhora', $ischeap, $isunderavg, $price, '$units');" +#echo "$linea2" mysql -h $DB_HOST -u root -p'Dsa-0213' enphase <