Aws-cdk: [aws-eks] BootstrapOptions enable_docker_bridge not working

Created on 14 Jan 2020  路  2Comments  路  Source: aws/aws-cdk

Description

This is my Python code

self.cluster.add_capacity(
            'worker-node',
            instance_type=ec2.InstanceType('t3.small'),
            desired_capacity=1,
            bootstrap_options=eks.BootstrapOptions(
                enable_docker_bridge=True
                ),
            key_name='eks-test-env-cluster'
        )

And this is cdk diff output

" --kubelet-extra-args \"--node-labels lifecycle=OnDemand\" --use-max-pods true --enable-docker-bridge\n/opt/aws/bin/cfn-signal --exit-code $? --stack test-eks-cluster --resource ekscontrolplaneworkernodeASG14CBDF68 --region ap-northeast-2"

there is only --enable-docker-bridge

Base on bootstrap.sh. I think --enable-docker-bridge should be --enable-docker-bridge true
https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh#L334

And I found these code. Maybe extraArgs.push --enable-docker-bridge can be --enable-docker-bridge true or kind of --enable-docker-bridge ${boolean}
https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-eks/lib/user-data.ts#L22

Reproduction Steps

self.cluster.add_capacity(
            'worker-node',
            instance_type=ec2.InstanceType('t3.small'),
            desired_capacity=1,
            bootstrap_options=eks.BootstrapOptions(
                enable_docker_bridge=True
                ),
            key_name='eks-test-env-cluster'
        )

After cdk deploy then check kubectl get nodes.

But ec2 still alive and kubelet is dead. So I run script manually.

sudo systemctl stop docker
sudo systemctl stop kubelet
systemctl status kubelet    << need stop properly 
systemctl status docker     << need stop properly
sudo /etc/eks/bootstrap.sh ekscontrolplane79F9EC48-dc9daaf8f83546c3908b3eec9917d8a4 --kubelet-extra-args '--node-labels lifecycle=OnDemand' --use-max-pods true --enable-docker-bridge true
sudo systemctl start docker
docker ps
systemctl status kubelet
sudo systemctl start kubelet
cat /etc/docker/daemon.json

And check kubectl get nodes status is Ready

Error Log

less /var/log/cloud-init-output.log would see only --enable-docker-bridge

+ /etc/eks/bootstrap.sh ekscontrolplane79F9EC48-dc9daaf8f83546c3908b3eec9917d8a4 --kubelet-extra-args '--node-labels lifecycle=OnDemand' --use-max-pods true --enable-docker-bridge

Environment

  • **CLI Version : 1.20.0 (build 021c521)
  • **Framework Version: 1.20.0
  • **OS : Mac
  • **Language : Python 3.7.4

Other


This is :bug: Bug Report

@aws-cdaws-eks bug p1

Most helpful comment

Hi @RicoToothless, thanks for reporting this. We will update this issue when there is movement.

All 2 comments

Hi @RicoToothless, thanks for reporting this. We will update this issue when there is movement.

But still have other option can enable docker bridge.

            bootstrap_options=eks.BootstrapOptions(
                docker_config_json=read_docker_daemon_resource('kubernetes_resources/docker-daemon.json')
            ),

```python
def read_docker_daemon_resource(filename):
with open(filename,'r') as stream:
return json.dumps(json.load(stream))

docker config file `kubernetes_resources/docker-daemon.json`
```json
{
    "bridge": "docker0",
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "10m",
        "max-file": "10"
    },
    "live-restore": false,
    "max-concurrent-downloads": 10
}
Was this page helpful?
0 / 5 - 0 ratings