You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Before you begin learning, you will need to install the required CLIs to create and manage your Kubernetes clusters in IBM Cloud Container Service, and to deploy containerized apps to your cluster.
4
+
Before you begin learning, you need to install the required CLIs to create and manage your Kubernetes clusters in IBM Cloud Container Service and to deploy containerized apps to your cluster.
5
5
6
6
This lab includes the information for installing these CLIs and plug-ins:
7
7
8
8
9
9
```txt
10
10
IBM Cloud CLI version 0.5.0 or later
11
11
IBM Cloud Container Service plug-in
12
-
Kubernetes CLI version 1.5.6 or later
12
+
Kubernetes CLI version 1.7.4 or later
13
13
Optional: IBM Cloud Container Registry plug-in
14
14
Optional: Docker version 1.9. or later
15
15
```
16
16
17
17
If you have the CLIs and plug-ins, you can skip this lab and proceed to the next one.
18
18
19
-
20
19
To install the CLIs:
21
20
22
21
As a prerequisite for the IBM Cloud Container Service plug-in, install the IBM Cloud command-line interface, located at https://clis.ng.bluemix.net/ui/home.html. Once installed, you can access IBM Cloud from your command-line with the prefix `bx`.
23
22
24
23
Log in to the IBM Cloud CLI with `bx login`. Enter your IBM Cloud credentials when prompted.
25
24
26
-
27
-
28
25
Note: If you have a federated ID, use `bx login --sso` to log in to the IBM Cloud CLI. Enter your user name and use the provided URL in your CLI output to retrieve your one-time passcode. You know you have a federated ID when the login fails without the `--sso` and succeeds with the `--sso` option.
29
26
30
27
# Install the IBM Cloud Container Service plug-in
@@ -41,31 +38,31 @@ The IBM Cloud Container Service plug-in is displayed in the results as `containe
41
38
42
39
To view a local version of the Kubernetes dashboard and to deploy apps into your clusters, you will need to install the Kubernetes CLI. The following links will install the CLI. Simply click the link corresponding to your operating system:
43
40
44
-
OS X: https://storage.googleapis.com/kubernetes-release/release/v1.5.6/bin/darwin/amd64/kubectl
Tip: If you are using Windows, install the Kubernetes CLI in the same directory as the IBM Cloud CLI. This setup saves you some filepath changes when you run commands later.
49
46
50
-
For OSX and Linux users, complete the following steps.
47
+
For OSX and Linux users, complete the following steps:
51
48
52
-
Move the executable file to the `/usr/local/bin` directory with `mv /<path_to_file>/kubectl /usr/local/bin/kubectl` .
49
+
1.Move the executable file to the `/usr/local/bin` directory with `mv /<path_to_file>/kubectl /usr/local/bin/kubectl` .
53
50
54
-
Make sure that `/usr/local/bin` is listed in your PATH system variable.
51
+
2.Make sure that `/usr/local/bin` is listed in your PATH system variable.
55
52
56
-
```txt
57
-
echo $PATH
58
-
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
59
-
```
60
-
Convert the binary file to an executable. `chmod +x /usr/local/bin/kubectl`
53
+
```txt
54
+
echo $PATH
55
+
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
56
+
```
61
57
62
-
# Download the Container Registry Plugin
58
+
3. Convert the binary file to an executable. `chmod +x /usr/local/bin/kubectl`
63
59
64
-
To manage a private image repository, install the Cloud Container Registry plug-in. Use this plug-in to set up your own namespace in a multi-tenant, highly available, and scalable private image registry that is hosted by IBM, and to store and share Docker images with other users. Docker images are required to deploy containers into a cluster. The prefix for running registry commands is bx cr.
60
+
# Download the IBM Cloud Container Registry plug-in
65
61
62
+
To manage a private image repository, install the IBM Cloud Container Registry plug-in. Use this plug-in to set up your own namespace in a multi-tenant, highly available, and scalable private image registry that is hosted by IBM, and to store and share Docker images with other users. Docker images are required to deploy containers into a cluster. The prefix for running registry commands is `bx cr`.
66
63
67
64
`bx plugin install container-registry -r Bluemix`
68
65
To verify that the plug-in is installed properly, run`bx plugin list`
69
66
The plug-in is displayed in the results as `container-registry`.
70
67
71
-
To build images locally and push them to your registry namespace, install Docker If you are using Windows 8 or earlier, you can install the Docker Toolbox External link icon instead. The Docker CLI is used to build apps into images. The prefix for running commands by using the Docker CLI is docker.
68
+
To build images locally and push them to your registry namespace, [install Docker](https://www.docker.com/community-edition#/download). The Docker CLI is used to build apps into images. The prefix for running commands by using the Docker CLI is `docker`.
Copy file name to clipboardExpand all lines: Lab 4/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
-
# Highly Available Deployments with IBM Cloud Container Service
1
+
# Highly available deployments with IBM Cloud Container Service
2
2
3
-
The goal of this lab is to begin to understand how to deploy a highly available application. It's easier than many think, but can be expensive if deploying across multiple AZs. The example in this lab shows how to deploy an application across two worker nodes in the same AZ (a basic level of high availability, to explore the concepts).
3
+
The goal of this lab is to learn how to deploy a highly available application. It's easier than many think but can be expensive if deploying across multiple availability zones. In order to explore the concepts, this lab shows how to deploy an application across two worker nodes in the same availability zone, which is a basic level of high availability.
4
4
5
-
# Federated Kubernetes Cluster: Two Worker Nodes Running the Same Application
5
+
# Federated Kubernetes cluster: Two clusters running the same application
6
6
7
-
To get started, create a paid cluster with two workers and wait for it to provision.
7
+
To get started, create a paid cluster with two workers and wait for it to provision. If this is your first paid cluster, then you do not need to specify the public vlan and the private vlan.
While waiting, you need to download kubefed, which will allow you to set up a kubernetes federated cluster.
11
+
While waiting, you need to download kubefed, which will allow you to set up a Kubernetes federated cluster.
12
12
As this is for lab purposes only, we will be using an IBM liberty image as a basic template for an imaged application.
13
13
14
14
Download the kubefed tarfile using curl:
@@ -44,7 +44,7 @@ You’ll need to provide the kubeconfig context (called name in the entry above)
44
44
45
45
At this time, export the kubeconfig file for the admin user of the cluster using `bx cs cluster-config <nameOfCluster> --admin`, make a note of it for error handling later.
46
46
47
-
# Deploy a Federation Control Plane
47
+
# Deploy a federation control plane
48
48
49
49
To deploy a federation control plane on your host cluster, run `kubefed init` command. When you use `kubefed init`, you must provide the following:
50
50
@@ -150,7 +150,7 @@ Creating a namespace federation-system for federation system components... done
150
150
Creating federation control plane service......
151
151
```
152
152
153
-
# Deploying an Application to a Federated Cluster
153
+
# Deploying an application to a federated cluster
154
154
155
155
156
156
The API for Federated Deployment is compatible with the API for traditional Kubernetes Deployment. You can create a Deployment by sending a request to the federation data layer.
Copy file name to clipboardExpand all lines: Lab 5/README.md
+45-35Lines changed: 45 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,22 @@
1
1
# Security with IBM Cloud Container Service
2
2
3
+
This lab is intended to introduce a user to Kubernetes-specific security features used to limit the attack surface and harden your cluster against network threats. You can use built-in security features for risk analysis and security protection. These features help you protect your cluster infrastructure and network communication, isolate your compute resources, and ensure security compliance across your infrastructure components and container deployments.
3
4
4
-
This lab is intended to introduce a user to kubernetes-specific security features used to limit the attack surface and harden your cluster against network threats. You can use built-in security features for risk analysis and security protection. These features help you to protect your cluster infrastructure and network communication, isolate your compute resources, and ensure security compliance across your infrastructure components and container deployments.
5
-
6
-
# Network Policies and Kubernetes: Adding network policies
7
-
In most cases, the default policies do not need to be changed. Only advanced security scenarios might require changes. If you find that you must make changes, install the Calico CLI and create your own network policies
5
+
# Network policies and Kubernetes: Adding network policies
6
+
In most cases, the default policies do not need to be changed. Only advanced security scenarios might require changes. If you find that you must make changes, install the Calico CLI and create your own network policies.
8
7
9
8
Before you begin:
10
9
11
-
Target the Kubernetes CLI to the cluster. Include the --admin option with the bx cs cluster-config command, which is used to download the certificates and permission files. This download also includes the keys for the Administrator rbac role, which you need to run Calico commands.
10
+
Target the Kubernetes CLI to the cluster. Include the --admin option with the bx cs cluster-config command, which is used to download the certificates and permission files. This download also includes the keys for the Administrator RBAC role, which you need to run Calico commands.
12
11
13
12
14
13
`bx cs cluster-config <cluster_name> --admin`
15
14
16
-
Note: Calico CLI version 1.4.0 is supported.
15
+
Note: Calico CLI version 1.6.1 is supported.
17
16
18
17
To add network policies:
19
18
20
-
Install the Calico CLI, from here: https://github.com/projectcalico/calicoctl/releases/tag/v1.4.0?cm_mc_uid=63538519175715059979315&cm_mc_sid_50200000=1506013543
19
+
Install the Calico CLI, from here: https://github.com/projectcalico/calicoctl/releases/tag/v1.6.1
21
20
22
21
Tip: If you are using Windows, install the Calico CLI in the same directory as the IBM Cloud CLI. This setup saves you some filepath changes when you run commands later.
Verify that the Calico configuration is working correctly.
118
123
119
124
Linux and OS X:
@@ -136,55 +141,56 @@ Examine the existing network policies.
136
141
137
142
View the Calico host endpoint.
138
143
139
-
140
144
`calicoctl get hostendpoint -o yaml`
141
-
View all of the Calico and Kubernetes network policies that were created for the cluster. This list includes policies that might not be applied to any pods or hosts yet. For a network policy to be enforced, it must find a Kubernetes resource that matches the selector that was defined in the Calico network policy.
142
145
146
+
View all of the Calico and Kubernetes network policies that were created for the cluster. This list includes policies that might not be applied to any pods or hosts yet. For a network policy to be enforced, it must find a Kubernetes resource that matches the selector that was defined in the Calico network policy.
143
147
144
148
`calicoctl get policy -o wide`
145
-
View details for a network policy.
146
149
150
+
View details for a network policy.
147
151
148
152
`calicoctl get policy -o yaml <policy_name>`
149
-
View the details of all network policies for the cluster.
150
153
154
+
View the details of all network policies for the cluster.
151
155
152
156
`calicoctl get policy -o yaml`
153
-
Create the Calico network policies to allow or block traffic.
154
157
155
158
# Lab Test: Define a Calico network policy
156
159
157
-
Defining a calico network policy for kubernetes clusters is simple once the calico cli is installed.
160
+
Defining a Calico network policy for Kubernetes clusters is simple once the Calico CLI is installed.
158
161
This part of the lab walks through using the Calico APIs directly in conjunction with Kubernetes `NetworkPolicy` in order to define more complex network policies.
159
162
160
-
Begin by creating a network policy object:
163
+
Begin by creating a namespace in your Kubernetes cluster:
Because we’ve enabled isolation on the Namespace, the profile denies all ingress traffic and allows all egress traffic.
188
+
189
+
Because we’ve enabled isolation on the namespace, the profile denies all ingress traffic and allows all egress traffic. Inspect the YAML file to verify.
190
+
191
+
`calicoctl get profile k8s_ns.advanced-policy-demo -o yaml`
192
+
186
193
```
187
-
$ calicoctl get profile k8s_ns.advanced-policy-demo -o yaml
Taking a closer look, we can see that they reference the correct profile for the Namespace, and that the correct label information has been filled in. Notice that the endpoint also includes a special label calico/k8s_ns, which is automatically populated with the pod’s Kubernetes Namespace.
231
+
232
+
Taking a closer look, we can see that they reference the correct profile for the namespace, and that the correct label information has been filled in. Notice that the endpoint also includes a special label calico/k8s_ns, which is automatically populated with the pod’s Kubernetes namespace.
233
+
225
234
```
226
235
$ calicoctl get wep --workload advanced-policy-demo.nginx-701339712-x1uqe -o yaml
Now, Simply create a new kubernetes config yaml file, this time with `kind: NetworkPolicy`. The sample below shows an example network policy which allows traffic.
256
+
257
+
Now, create a new Kubernetes config yaml file, this time with `kind: NetworkPolicy`. The sample below shows an example network policy which allows traffic.
248
258
249
259
Create a file named `networkpol.yaml`, and enter the following information into the file:
250
260
@@ -270,7 +280,7 @@ Linux and OS X:
270
280
271
281
`calicoctl apply -f networkpol.yaml`
272
282
273
-
It now shows up as a Policy object in the Calico API.
283
+
It now shows up as a policy object in the Calico API.
0 commit comments