This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AKS Deployment | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
AZURE_CONTAINER_REGISTRY: "repo.azurecr.io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logs in to the Azure Container Registry | |
- uses: Azure/docker-login@v1 | |
with: | |
login-server: ${{ env.AZURE_CONTAINER_REGISTRY }} | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
# Build and push image to Azure Container Registry | |
- name: Build and push image to Azure Container Registry | |
run: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Versoin one | |
oc get $(oc api-resources --namspaced=true | tail -n+2 | awk '{ print $1 }' | xargs | sed -e 's/\s/,/g') | |
# Version two (from https://access.redhat.com/solutions/4165791) | |
oc api-resources --verbs=list --namespaced -o name | xargs -n 1 oc get --show-kind --ignore-not-found -n $PROJECT_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
annotations: | |
deployment.kubernetes.io/revision: "1" | |
kubectl.kubernetes.io/last-applied-configuration: | | |
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"basic-ocp-demo"},"name":"basic-ocp-demo","namespace":"basic-ocp-demo-project"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"basic-ocp-demo"}},"template":{"metadata":{"labels":{"app":"basic-ocp-demo"}},"spec":{"containers":[{"env":[{"name":"BASIC_OCP_DEMO_ENV","value":"master"}],"image":"quay.io/freedomben/basic-ocp-demo:latest","imagePullPolicy":"Always","name":"basic-ocp-demo","ports":[{"containerPort":4567,"protocol":"TCP"}],"readinessProbe":{"httpGet":{"path":"/healthz","port":4567,"scheme":"HTTP"},"initialDelaySeconds":5,"periodSeconds":1}}]}}}} | |
creationTimestamp: "2021-01-08T02:09:21Z" | |
generation: 1 | |
labels: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -k "https://basic-ocp-demo-basic-ocp-demo-project.apps.cluster1.example.com/healthz" | |
# or build the curl URL programmatically! | |
curl -k "https://$(oc get route basic-ocp-demo -o jsonpath="{.spec.host}")/healthz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function finish { | |
rm -rf $TMPDIR | |
} | |
trap finish EXIT | |
TMPDIR=$(mktemp -d) | |
oc get nodes -o name > $TMPDIR/all-nodes | |
oc get nodes -o name -l logging-infra-fluentd=true > $TMPDIR/labeled-nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubernetes commands | |
kubectl config view - посмотреть к какому кластеру подключен kubectl (API IP:PORT) | |
kubectl get pods && kubectl get services --all-namespaces | |
kubectl get nodes - список нодов | |
kubectl exec -it postgres-57f4746d96-7z5q8 -- psql -U username databasename - подключиться к psql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd k8s-specs | |
# Only if minishift | |
oc apply -f sa/jenkins-no-sa-oc.yml --record | |
# Only if NOT minishift | |
kubectl apply \ | |
-f sa/jenkins-no-sa.yml \ | |
--record |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Step 1 | |
oc delete pod <podsname> -n myproject --grace-period=0 --force | |
### Step 2 | |
oc edit pod <podsname> | |
#Remove deletionTimestamp | |
#Before: deletionTimestamp: 2019-12-31T11:40:28Z | |
#After: deletionTimestamp: null | |
#Remove Finalizers | |
#Before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Creating a template | |
oc login <YOUR_MINISHIFT_URL> | |
oc login -u system:admin | |
oc create -f <YOUR_YAML_FILE>.yaml -n openshift | |
###View/Edit template | |
oc edit template <YOUR_TEMPLATE> -n openshift | |
###View all templates available | |
oc get templates -n openshift |