Create Resources
Before creating network polices, let’s create the required resources.
Create a new folder for the configuration files.
mkdir ~/environment/calico_resources
cd ~/environment/calico_resources
Stars Namespace
Copy/Paste the following commands into your Cloud9 Terminal.
cd ~/environment/calico_resources
wget https://eksworkshop.com/beginner/120_network-policies/calico/stars_policy_demo/create_resources.files/namespace.yaml
Let’s examine our file by running cat namespace.yaml
.
Create a namespace called stars:
kubectl apply -f namespace.yaml
We will create frontend and backend replication controllers and services in this namespace in later steps.
Copy/Paste the following commands into your Cloud9 Terminal.
cd ~/environment/calico_resources
wget https://eksworkshop.com/beginner/120_network-policies/calico/stars_policy_demo/create_resources.files/management-ui.yaml
wget https://eksworkshop.com/beginner/120_network-policies/calico/stars_policy_demo/create_resources.files/backend.yaml
wget https://eksworkshop.com/beginner/120_network-policies/calico/stars_policy_demo/create_resources.files/frontend.yaml
wget https://eksworkshop.com/beginner/120_network-policies/calico/stars_policy_demo/create_resources.files/client.yaml
cat management-ui.yaml
Create a management-ui namespace, with a management-ui service and replication controller within that namespace:
kubectl apply -f management-ui.yaml
cat backend.yaml
to see how the backend service is built:
Let’s examine the frontend service with cat frontend.yaml
:
Create frontend and backend replication controllers and services within the stars namespace:
kubectl apply -f backend.yaml
kubectl apply -f frontend.yaml
Lastly, let’s examine how the client namespace, and a client service for a replication controller.
are built. cat client.yaml
:
Apply the client configuraiton.
kubectl apply -f client.yaml
Check their status, and wait for all the pods to reach the Running status:
kubectl get pods --all-namespaces
Your output should look like this:
It may take several minutes to download all the required Docker images.
To summarize the different resources we created:
- A namespace called stars
- frontend and backend replication controllers and services within stars namespace
- A namespace called management-ui
- Replication controller and service management-ui for the user interface seen on the browser, in the management-ui namespace
- A namespace called client
- client replication controller and service in client namespace