This has to be a key skill for the next for years in DevOps

cf

  • AKS Microsoft’s Azure based implemenation

kubectl

Learning

Notes on learning based on running K8S on macOS Docker Decktop.

kubectl run nginx --image=nginx --restart=Never

pod/nginx created

export KUBECONFIG=~/.kube/config
kubectl edit resourceQuota compute-resources

kubectl get rs
kubectl describe rs <rs-name>
kubectl get pods

kubectl apply -f some-file.yaml
kubectl get secrets <---> -o yaml > some-file.yaml

## RBAC (Resource Based Access Control)


Hi, We saw a bit of an issue on one of our Clusters last week where Kured had put one of our nodes into Scheduling Disabled but due to an out of Date Pod Disruption Budget policy on one of the Pods, it couldn’t be scheduled to another node. I could see this from running a kubectl get nodes and the node state being Ready,SchedulingDisabled. Then checking the Kured Logs and seeing it complaining about the offending Pod. So it was easy to fix, but my concern was we didn’t know this was happening and we had a node which was unable to schedule pods during this.

I’ve written this in Grafana to get that state out of the KubeEvents for our monitor dashboard, thought I would share

let clusterName = "$clusterName";
KubeEvents
| where $__timeFilter(TimeGenerated)
| where ClusterName == clusterName and Reason == "NodeNotSchedulable"
| count

I’ve been trying to get the Kured logs out of log analytics with not much success (you cant see them in Container Insights through the portal either). Be good to have these logged in a dashboard for when Kured is having issues getting Pods scheduled. Has any one had any luck doing something like this?


Using TypeScript

tfs-cli (In github) npm etc

Tiller

Tiller, the server portion of Helm, typically runs inside of your Kubernetes cluster. But for development, it can also be run locally, and configured to talk to a remote Kubernetes cluster.

The easiest way to install tiller into the cluster is simply to run helm init (Or install locally via brew install kubernetes-helm)

After helm init, you should be able to run kubectl get pods --namespace kube-system and see Tiller running.

kubectl

Read the [[[Docker] notes first, then:

kubectl run demo --image=rikwatson/myhello --port=9999 --labels app=demo
kubectl port-forward deploy/demo 9999:8888

Some kubectl commands:

kubectl version

kubectl config view

JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'  && \
    kubectl get nodes -o jsonpath="$JSONPATH" | grep "Ready=False"
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'  && \
    kubectl get nodes -o jsonpath="$JSONPATH" | grep "Ready=True"

kubectl api-resources --namespaced=false
kubectl apply -f sizemanagement-config-3af5579d5f.yaml --alsologtostderr=true
kubectl auth can-i create deployments --namespace backoffice-prod
kubectl auth can-i create deployments --namespace sizing-prod
kubectl config get-contexts
kubectl config set-context --current --namespace=sizing-prod
kubectl config shoe-contexts
kubectl config show-contexts
kubectl config use-context ecomm-backOffice-eun-k8-prod
kubectl config view | grep namespace:
kubectl get --all-namespaces
kubectl get deployment
kubectl get deployment -n sizing-prod
kubectl get deployment sizemanagement-deployment-e6091cd
kubectl get deployments -n sizing-prod
kubectl get events --sort-by=.metadata.creationTimestamp
kubectl get events --sort-by=.metadata.creationTimestamp -n sizing-prod
kubectl get logs backoffice-navigation-api-deployment-a98afc9-df47c6b8c-7qz5g
kubectl get namespace
kubectl get namespaces
kubectl get --namespaces
kubectl get nodes
kubectl get pods
kubectl get pods --all-namespaces
kubectl get pods --all-namespaces | grep navi
kubectl get pods --all-namespaces --include-uninitialized
kubectl get pods -n
kubectl get pods -n backoffice-prod
kubectl get pods -n sizing-prod
kubectl get pods -n sizing-prod --include-uninitialized
kubectl logs backoffice-navigation-api-deployment-a98afc9-df47c6b8c-7qz5g > backoffice-navigation-api-deployment-a98afc9-df47c6b8c-7qz5g.log
kubectl options
kubectl set
kubectl set namespace
kubectl set namespace backoffice-prod
kubectl set namespace sizing-prod

Esin’s Notes on AKS / K8S

Backoffice2 in Azure DevOPs

IaC 01-Host VM

IaC 02-AKS

Stages : Dev / E2e / Prod

NonProd - EUW

  • Create AKS Pipline (currently OctDep)
  • Traffik Manager profile & end-point

E2E - EUN - EUW

Prod - EUW - EUN

dyndns.com

dynect.com - it ticket for DynDns

Test Repo & play. cf BackOffice2-Audit-Api-CI

  • Look into trigger options branches / master / PRs etc

See Custom Conditions.

Helm

Use Helm Red/Green via:

helm upgrade --namespace $ --reuse-values --set autoscale\_\_minReplicas=1 --set autoscale\_\_maxReplicas=1 --kubeconfig $(decodedKubeConfigPath) --version=$currentStagingSlot "$deployment" "$/$"

backoffice-product-web (feature/helm)

./prodweb

values.yaml via helpers.tpl

Azure Pipline Tasks

Using TypeScript

tfs-cli (In github) npm etc

## Istio

istio