Deploy Docker App to Kubernetes Cluster
.github/workflows/push.yml
on: push
name: deploy
jobs:
deploy:
name: deploy to cluster
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Deploy to Kubernetes cluster
uses: josuelopezv/K8AppDeploy@main
with:
kube-config: ${{ secrets.KUBE_CONFIG_DATA}}
container-image: nginx:latest
app-name: my-app
app-namespace: app-example
ingress-hostname: example.agileliteracy.com
app-port: 80
ingress-extra-annotations: |
nginx.ingress.kubernetes.io/proxy-buffering: "on",
nginx.ingress.kubernetes.io/proxy-buffer-size: "8k"
extra-cmd: |
kubectl get pods -A
echo "completed"
kube-config
– required: A base64-encoded kubeconfig file with credentials for Kubernetes to access the cluster. You can get it by running the following command:
cat $HOME/.kube/config | base64
container-image
– required: The container image to pull in kubernetes. Can use private registry for example repo.example.com/nginix:latest
app-name
– required: Name to be used for kubernetes resources: service, deploy, pod, ingress
app-namespace
- : Namespace to be used generated and used for kubernetes resources: service, deploy, pod, ingress
app-port
– required: Container port exposed by image to use as source for ingress reverse proxy
ingress-hostname
– required: Ingress host. For example app.mydomain.com
ingress-path
– : Ingress path used for backend and frontend. Default value: /
. See https://kubernetes.io/docs/concepts/services-networking/ingress/
ingress-extra-annotations
– : Additional annotations for the ingress. String separated by coma. See some nginx specific ingrees annotations https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations
extra-cmd
– : extra bash commands to run after deploy
container-extra-env
– : Additional env variables for the container. String separated by coma. For Example: {name: DEMO_GREETING, value: "Hello from the environment"}, {name: DEMO_FAREWELL, value: "Such a sweet sorrow"}