k8s deployment strategies

1. start local Kubernetes v1.10.0 cluster…

minikube start --kubernetes-version v1.10.0 --memory 8192 --cpus 2

Errors:

If it hangs on:

Starting cluster components...

You can see what’s going on with:

minikube logs

which spits out thousands of lines of logs.

Annoyingly minikube logs -f does not work even though it’s implemented internally: https://github.com/kubernetes/dashboard/issues/1083

See Installing Kubernetes: Minikube for a solution.

 

2. helm init

3. Install Prometheus

helm install \
    --namespace=monitoring \
    --name=prometheus \
    --version=7.0.0 \
    stable/prometheus

which outputs

NAME:   prometheus
LAST DEPLOYED: Thu Nov  1 13:22:45 2018
NAMESPACE: monitoring
STATUS: DEPLOYED

RESOURCES:
==> v1/PersistentVolumeClaim
NAME                     AGE
prometheus-alertmanager  1s
prometheus-server        1s

==> v1beta1/ClusterRoleBinding
prometheus-kube-state-metrics  1s
prometheus-server              1s

==> v1beta1/DaemonSet
prometheus-node-exporter  1s

==> v1/ConfigMap
prometheus-alertmanager  1s
prometheus-server        1s

==> v1/ServiceAccount
prometheus-alertmanager        1s
prometheus-kube-state-metrics  1s
prometheus-node-exporter       1s
prometheus-pushgateway         1s
prometheus-server              1s

==> v1beta1/ClusterRole
prometheus-kube-state-metrics  1s
prometheus-server              1s

==> v1/Service
prometheus-alertmanager        1s
prometheus-kube-state-metrics  1s
prometheus-node-exporter       1s
prometheus-pushgateway         1s
prometheus-server              1s

==> v1beta1/Deployment
prometheus-alertmanager        1s
prometheus-kube-state-metrics  1s
prometheus-pushgateway         0s
prometheus-server              0s

==> v1/Pod(related)

NAME                                            READY  STATUS             RESTARTS  AGE
prometheus-node-exporter-mfgcj                  0/1    ContainerCreating  0         1s
prometheus-alertmanager-99f6bfbcc-b8hkc         0/2    ContainerCreating  0         0s
prometheus-kube-state-metrics-6584885ccf-fkkxc  0/1    ContainerCreating  0         0s
prometheus-pushgateway-d5fdc4f5b-m7kzj          0/1    ContainerCreating  0         0s
prometheus-server-86887bb56b-sjwhq              0/2    Pending            0         0s


NOTES:
The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster:
prometheus-server.monitoring.svc.cluster.local


Get the Prometheus server URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace monitoring port-forward $POD_NAME 9090


The Prometheus alertmanager can be accessed via port 80 on the following DNS name from within your cluster:
prometheus-alertmanager.monitoring.svc.cluster.local


Get the Alertmanager URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace monitoring port-forward $POD_NAME 9093


The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster:
prometheus-pushgateway.monitoring.svc.cluster.local


Get the PushGateway URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=pushgateway" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace monitoring port-forward $POD_NAME 9091

For more information on running Prometheus, visit:
https://prometheus.io/

Note: it mentions `ContainerCreating` – you can check on the current status with:

helm list

This shows you the state of the pod you’ve just created:

prometheus 1 Thu Nov 1 13:22:45 2018 DEPLOYED prometheus-7.0.0 2.3.2 monitoring

which had those 4 containers:

prometheus-node-exporter-mfgcj 0/1 ContainerCreating 0 1s prometheus-alertmanager-99f6bfbcc-b8hkc 0/2 ContainerCreating 0 0s prometheus-kube-state-metrics-6584885ccf-fkkxc 0/1 ContainerCreating 0 0s prometheus-pushgateway-d5fdc4f5b-m7kzj 0/1 ContainerCreating 0 0s prometheus-server-86887bb56b-sjwhq 0/2 Pending 0 0s

 

 

 

Source: https://github.com/ContainerSolutions/k8s-deployment-strategies

Leave a Reply

Your email address will not be published. Required fields are marked *