When I create an EKS cluster with LocalStack:
awslocal eks create-cluster \
--name cluster1 \
--role-arn "arn:aws:iam::000000000000:role/eks-role" \
--resources-vpc-config "{}"
Confirm:
awslocal eks describe-cluster --name cluster1
{
"cluster": {
"name": "cluster1",
"arn": "arn:aws:eks:ap-northeast-1:000000000000:cluster/cluster1",
"createdAt": "2024-05-22T13:52:00.327000+09:00",
"version": "1.22",
"endpoint": "https://localhost.localstack.cloud:4511",
"roleArn": "arn:aws:iam::000000000000:role/eks-role",
"resourcesVpcConfig": {
"securityGroupIds": [],
"endpointPublicAccess": true,
"endpointPrivateAccess": false,
"publicAccessCidrs": [
"0.0.0.0/0"
]
},
"identity": {
"oidc": {
"issuer": "https://localhost.localstack.cloud/eks-oidc"
}
},
"status": "ACTIVE",
....
}
Set kubernetes context:
awslocal eks update-kubeconfig --name cluster1 && \
kubectl config use-context arn:aws:eks:ap-northeast-1:000000000000:cluster/cluster1
Why got error when run kubectl command?
kubectl get po
I0522 14:04:44.688006 27587 versioner.go:58] Get "https://localhost.localstack.cloud:4511/version?timeout=5s": EOF
E0522 14:04:55.119358 27587 memcache.go:265] couldn't get current server API group list: Get "https://localhost.localstack.cloud:4511/api?timeout=32s": EOF
The EKS' endpoint is using 4511. The LocalStack's default endpoint is 4566. Is the port a reason?
Which version of the localstack are you using? The main entrypoint to localstack is port 4566, and then internally traffic is routed to the correct service. I was able to successfully run EKS with the same commands as you provided above.
What it looks like more, is that your host can't reach the localstack container, can you share some more details on how are you starting LocalStack, and what configuration you are using?
It may be worth taking a look on our networking guide here: Networking Guide