Create Services

In this section, we will create all the Kubernetes resources needed for the workshop:

  • K8s namespace
  • K8s services
  • Spot Deployment

Let’s start by creating a local file on your machine and name it k8s-e2e.yaml


Stable

kind: Namespace
apiVersion: v1
metadata:
  name: oceancd-workshop
  labels:
    name: oceancd-workshop

---

apiVersion: spot.io/v1beta1
kind: SpotDeployment
metadata:
  name: nginx-deployment
  namespace: oceancd-workshop
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: public.ecr.aws/nginx/nginx:1.22
        ports:
        - containerPort: 8080

---

apiVersion: v1
kind: Service
metadata:
  name: rollouts-demo-stable
  namespace: oceancd-workshop
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080


---

apiVersion: v1
kind: Service
metadata:
  name: rollouts-demo-canary
  namespace: oceancd-workshop
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080


Time to Apply

Run the following command to deploy your end-to-end template

kubectl apply -f k8s-e2e.yaml

You will not need to make any changes to this YAML file. The next section will utilize the resources you just created.

Configure the OceanCD CLI

The next section of this workshop will utilize the Ocean CD CLI.