The Application Operator is a Kubernetes operator built using the Go plugin of Operator SDK. It automates the process of deploying an application as a Kubernetes Deployment and exposing it as a Kubernetes Service.
- Kubernetes cluster
kubectl
installed and configured to interact with your cluster- Operator SDK
- Clone the repository:
git clone https://github.com/yourusername/application-operator.git
cd application-operator
- Install the CRD:
kubectl apply -f config/crd/bases/
- Install the Operator:
kubectl apply -f config/manager/
- Create an Application resource:
apiVersion: api.app.op/v1alpha1
kind: Application
metadata:
labels:
app.kubernetes.io/name: application
app.kubernetes.io/instance: application-sample
app.kubernetes.io/part-of: application-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: application-operator
name: application-sample
spec:
replicas: 2
image: sayedimran/fastapi-sample-app:v4
port: 7000
env:
- name: APP_ENV
value: production
- name: APP_NAME
value: fastapi-sample-app
- Apply the resource:
kubectl apply -f config/samples/
- Verify that the Application resource has been created:
kubectl get app
- Verify that the Deployment and Service resources have been created:
kubectl get deployment
kubectl get service