I have an EKS cluster and i am trying to automate the process of creating a deployment-pod, accessing the pod using a terminal shell, running some commands within it and destroying the deployment.
i created a document with the commands, starting with creating a deployment-pod but doesn't seem to get pass the create deployment.
below is the command
"kubectl create deployment --image=**********.dkr.ecr.ap-*****.amazonaws.com/csstatic0:1 testpod"
but i kept on getting this error
The connection to the server localhost:8080 was refused - did you specify the right host or port?
I researched, and found adding the serviceAccountName in the command resolves the issue but still doesn't work.
I also created a YAML manifest with the serviceAccountName provided within but still got the same error.
apiVersion: apps/v1
kind: Deployment
metadata:
name: vulmelon
spec:
replicas: 1
selector:
matchLabels:
app: vulmelon
template:
metadata:
labels:
app: vulmelon
spec:
containers:
- name: vulmelon
image=**********.dkr.ecr.ap-*****.amazonaws.com/csstatic0:1 testpod
serviceAccountName: default
What am I missing here?
your helps will be highly appreciated